Skip to content

Commit

Permalink
Merge pull request #7 from ozgurg/dev
Browse files Browse the repository at this point in the history
release: v1.1.3
  • Loading branch information
ozgurg committed Sep 10, 2022
2 parents f328593 + 983120e commit ae4b131
Show file tree
Hide file tree
Showing 15 changed files with 2,231 additions and 1,534 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.ts
update-dependencies.js
128 changes: 89 additions & 39 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,93 @@
{
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": [
"google"
],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {
"require-jsdoc": "off",
"quotes": [
"error",
"double"
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": [
"google"
],
"indent": [
"error",
4,
{
"SwitchCase": 1
}
"plugins": [
"jsdoc"
],
"max-len": [
"off"
],
"object-curly-spacing": [
"error",
"always"
],
"comma-dangle": [
"error",
"never"
],
"arrow-parens": [
"error",
"as-needed"
]
}
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {
"require-jsdoc": "off",
"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"
],
"valid-jsdoc": 0,
"jsdoc/check-access": 1,
"jsdoc/check-alignment": 1,
"jsdoc/check-indentation": 1,
"jsdoc/check-line-alignment": 1,
"jsdoc/check-param-names": 1,
"jsdoc/check-property-names": 1,
"jsdoc/check-syntax": 1,
"jsdoc/check-tag-names": 1,
"jsdoc/check-types": 1,
"jsdoc/check-values": 1,
"jsdoc/empty-tags": 1,
"jsdoc/implements-on-classes": 1,
"jsdoc/match-description": 1,
"jsdoc/multiline-blocks": 1,
"jsdoc/newline-after-description": 1,
"jsdoc/no-bad-blocks": 1,
"jsdoc/no-defaults": 1,
"jsdoc/no-missing-syntax": 0,
"jsdoc/no-multi-asterisks": 1,
"jsdoc/no-restricted-syntax": 0,
"jsdoc/no-types": 0,
"jsdoc/no-undefined-types": 1,
"jsdoc/require-asterisk-prefix": 1,
"jsdoc/require-description": 0,
"jsdoc/require-description-complete-sentence": 0,
"jsdoc/require-example": 0,
"jsdoc/require-file-overview": 0,
"jsdoc/require-hyphen-before-param-description": 1,
"jsdoc/require-jsdoc": 1,
"jsdoc/require-param": 1,
"jsdoc/require-param-description": 0,
"jsdoc/require-param-name": 1,
"jsdoc/require-param-type": 1,
"jsdoc/require-property": 1,
"jsdoc/require-property-description": 1,
"jsdoc/require-property-name": 1,
"jsdoc/require-property-type": 1,
"jsdoc/require-returns": 1,
"jsdoc/require-returns-check": 1,
"jsdoc/require-returns-description": 0,
"jsdoc/require-returns-type": 1,
"jsdoc/require-throws": 1,
"jsdoc/require-yields": 1,
"jsdoc/require-yields-check": 1,
"jsdoc/tag-lines": 1,
"jsdoc/valid-types": 1
}
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,5 @@ dist

# IDE / Editor
.idea

.DS_Store
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/update-dependencies.js
/.run/
12 changes: 12 additions & 0 deletions .run/lint.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="lint" type="js.build_tools.npm" nameIsGenerated="true">
<package-json value="$PROJECT_DIR$/package.json" />
<command value="run" />
<scripts>
<script value="lint" />
</scripts>
<node-interpreter value="project" />
<envs />
<method v="2" />
</configuration>
</component>
12 changes: 12 additions & 0 deletions .run/test.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="test" type="js.build_tools.npm" nameIsGenerated="true">
<package-json value="$PROJECT_DIR$/package.json" />
<command value="run" />
<scripts>
<script value="test" />
</scripts>
<node-interpreter value="project" />
<envs />
<method v="2" />
</configuration>
</component>
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Özgür Görgülü
Copyright (c) 2022 Özgür Görgülü <ozgurgorgulu54@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
41 changes: 30 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ center, padCenter!
npm install pad-center
```

_This package is a [pure ESM package](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c)._

## Usage

```javascript
Expand All @@ -31,37 +33,54 @@ padCenter({
fillWith: "*",
length: 11
});
// Returns: "053*******0"
// "053*******0"

padCenter({
startWith: "GH1",
endWith: "9",
fillWith: "0",
length: 10
});
// Returns: "GH10000009"
// "GH10000009"

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

## API

### padCenter({ startWith, endWith, fillWith, length })
### padCenter(params) : string

#### params

Default: <code>{}</code>\
Type: <code>object</code>\
Required: Yes

#### params.startWith

Type: <code>string | number</code>\
Required: Yes

#### params.endWith

Type: <code>string | number</code>\
Required: Yes

#### params.fillWith

Type: <code>string | number</code>\
Required: Yes

All params are required.
#### params.length

| Param | Type |
|-----------|----------------------------------------|
| startWith | <code>string &#124; number</code> |
| endWith | <code>string &#124; number</code> |
| fillWith | <code>string &#124; number</code> |
| length | <code>number</code> (positive integer) |
Type: <code>number</code>\
Required: Yes

## License

Expand Down
Loading

0 comments on commit ae4b131

Please sign in to comment.