Skip to content

Commit 5d35773

Browse files
committed
Initial commit
0 parents  commit 5d35773

File tree

13 files changed

+7643
-0
lines changed

13 files changed

+7643
-0
lines changed

.babelrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"presets": ["@babel/env"],
3+
"env": {
4+
"production-esm": {
5+
"presets": [
6+
["@babel/env", { "modules": false }]
7+
]
8+
}
9+
}
10+
}

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/dist/*

.eslintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "wojtekmaj"
3+
}

.github/workflows/ci.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This workflow will do a clean install of node dependencies and run tests
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: CI
5+
6+
on:
7+
push:
8+
branches: [ '*' ]
9+
pull_request:
10+
branches: [ master ]
11+
12+
jobs:
13+
test:
14+
name: Test
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v2
20+
21+
- name: Use Node.js
22+
uses: actions/setup-node@v1
23+
with:
24+
node-version: '14.x'
25+
26+
- name: Install dependencies
27+
run: yarn --immutable
28+
29+
- name: Run tests
30+
run: yarn test

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.DS_Store
2+
.idea
3+
.vscode
4+
.yarn/*
5+
!.yarn/releases
6+
!.yarn/plugins
7+
dist
8+
coverage
9+
node_modules
10+
npm-debug.log
11+
yarn-error.log

.yarn/releases/yarn-2.4.0.cjs

Lines changed: 55 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
nodeLinker: node-modules
2+
3+
yarnPath: .yarn/releases/yarn-2.4.0.cjs

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Wojciech Maj
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
[![npm](https://img.shields.io/npm/v/is-valid-nip.svg)](https://www.npmjs.com/package/is-valid-nip) ![downloads](https://img.shields.io/npm/dt/is-valid-nip.svg) [![CI](https://github.com/wojtekmaj/is-valid-nip/workflows/CI/badge.svg)](https://github.com/wojtekmaj/is-valid-nip/actions) [![tested with jest](https://img.shields.io/badge/tested_with-jest-99424f.svg)](https://github.com/facebook/jest)
2+
3+
# is-valid-nip
4+
Check if a number is a valid Numer Identyfikacji Podatkowej (NIP).
5+
6+
## tl;dr
7+
* Install by executing `npm install is-valid-nip` or `yarn add is-valid-nip`.
8+
* Import by adding `import isValidNIP from 'is-valid-nip'`.
9+
* Use it by writing `const valid = isValidNIP('5252611332')`
10+
11+
## See also
12+
13+
* [is-valid-pesel](https://github.com/wojtekmaj/is-valid-pesel): Check if a number is a valid PESEL.
14+
* [is-valid-regon](https://github.com/wojtekmaj/is-valid-regon): Check if a number is a valid REGON.
15+
16+
## Examples
17+
18+
```js
19+
> isValidNIP('5252611332');
20+
< true
21+
22+
> isValidNIP('525-261-13-32');
23+
< true
24+
25+
> isValidNIP('525-26-11-332');
26+
< true
27+
```
28+
29+
## License
30+
31+
The MIT License.
32+
33+
## Author
34+
35+
<table>
36+
<tr>
37+
<td>
38+
<img src="https://github.com/wojtekmaj.png?s=100" width="100">
39+
</td>
40+
<td>
41+
Wojciech Maj<br />
42+
<a href="mailto:kontakt@wojtekmaj.pl">kontakt@wojtekmaj.pl</a><br />
43+
<a href="https://wojtekmaj.pl">https://wojtekmaj.pl</a>
44+
</td>
45+
</tr>
46+
</table>

package.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"name": "is-valid-nip",
3+
"version": "1.0.0",
4+
"description": "Check if a number is a valid Numer Identyfikacji Podatkowej (NIP)",
5+
"main": "dist/umd/index.js",
6+
"module": "dist/esm/index.js",
7+
"source": "src/index.js",
8+
"sideEffects": false,
9+
"scripts": {
10+
"build": "yarn build-esm && yarn build-umd",
11+
"build-esm": "BABEL_ENV=production-esm babel src -d dist/esm --ignore **/*.spec.js",
12+
"build-umd": "BABEL_ENV=production-umd babel src -d dist/umd --ignore **/*.spec.js",
13+
"clean": "rimraf dist",
14+
"jest": "jest",
15+
"lint": "eslint src/ --ext .jsx,.js",
16+
"prepublishOnly": "yarn clean && yarn build",
17+
"test": "yarn lint && yarn jest"
18+
},
19+
"keywords": [
20+
"validation",
21+
"nip"
22+
],
23+
"author": {
24+
"name": "Wojciech Maj",
25+
"email": "kontakt@wojtekmaj.pl"
26+
},
27+
"license": "MIT",
28+
"devDependencies": {
29+
"@babel/cli": "^7.0.0",
30+
"@babel/core": "^7.0.0",
31+
"@babel/preset-env": "^7.4.0",
32+
"eslint": "^7.12.0",
33+
"eslint-config-wojtekmaj": "^0.5.0",
34+
"jest": "^26.6.0",
35+
"rimraf": "^3.0.0"
36+
},
37+
"resolutions": {
38+
"rimraf@2.6.3": "^2.6.3",
39+
"semver@7.0.0": "^7.0.0"
40+
},
41+
"files": [
42+
"LICENSE",
43+
"README.md",
44+
"dist/",
45+
"src/"
46+
],
47+
"repository": "https://github.com/wojtekmaj/is-valid-nip.git"
48+
}

0 commit comments

Comments
 (0)