Skip to content

Commit

Permalink
Merge pull request #1 from ozgurg/dev
Browse files Browse the repository at this point in the history
release: v1.0.0
  • Loading branch information
ozgurg authored Jul 1, 2022
2 parents 0ad2199 + bbac521 commit f7c80cb
Show file tree
Hide file tree
Showing 12 changed files with 8,681 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
42 changes: 42 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": [
"google"
],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {
"quotes": [
"error",
"double"
],
"indent": [
"error",
4,
{
"SwitchCase": 1
}
],
"max-len": [
"off"
],
"object-curly-spacing": [
"error",
"always"
],
"comma-dangle": [
"error",
"never"
],
"arrow-parens": [
"error",
"as-needed"
]
}
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,6 @@ dist

# TernJS port file
.tern-port

# IDE / Editor
.idea
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run lint-staged
4 changes: 4 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run test
50 changes: 49 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,49 @@
# pad-center
![Downloads](https://img.shields.io/npm/dm/pad-center)
![Version](https://img.shields.io/github/package-json/v/ozgurg/pad-center)

# pad-center

pad-center fills between start and end characters with whatever character you want while keeping the length constant.

## Install

```bash
npm install pad-center
```

## Usage

```javascript
import padCenter from "pad-center";

padCenter({
startWith: "053",
endWith: "0",
fillWith: "*",
length: 11
});
// Returns: "053*******0"

padCenter({
startWith: "O",
endWith: "G",
fillWith: "_",
length: 8
});
// Returns: "O______G"
```

## API

### padCenter({ startWith, endWith, fillWith, length })

| Option | Is required? | Type |
|-----------|--------------|---------------------|
| startWith | true | `string` `number` |
| endWith | true | `string` `number` |
| fillWith | true | `string` `number` |
| length | true | `integer`(positive) |

## License

[![License](https://img.shields.io/github/license/ozgurg/pad-center)](https://github.com/ozgurg/pad-center/blob/main/LICENSE)
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { padCenter } from "./src/pad-center.js";

export default padCenter;
Loading

0 comments on commit f7c80cb

Please sign in to comment.