Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
hosmelq committed Sep 23, 2019
1 parent ba8b67d commit 20f0452
Show file tree
Hide file tree
Showing 10 changed files with 7,349 additions and 667 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
19 changes: 0 additions & 19 deletions .eslintrc.json

This file was deleted.

7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
/dist
/node_modules

.DS_Store

npm-debug.log*
yarn-debug.log*
yarn-error.log*
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package-lock=false
save-exact=true
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10.16
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"bracketSpacing": false,
"parser": "babel",
"semi": false,
"singleQuote": true
}
16 changes: 0 additions & 16 deletions index.js

This file was deleted.

35 changes: 25 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,44 @@
{
"name": "dnic",
"version": "1.0.0",
"version": "0.0.1",
"description": "ID Nicaraguan validator",
"main": "index.js",
"main": "dist/index.js",
"umd:main": "dist/index.umd.js",
"module": "dist/index.es.js",
"source": "src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"build": "microbundle",
"test": "xo",
"prepare": "npm run build",
"release": "np"
},
"repository": {
"type": "git",
"url": "git+https://github.com/nerdify/Dnic.git"
"url": "git+https://github.com/nerdify/dnic.git"
},
"keywords": [
"dni",
"nicaraguan",
"nica",
"nicaragua",
"nicaraguan",
"validator"
],
"author": "Gustavo Chavarria",
"license": "ISC",
"bugs": {
"url": "https://github.com/nerdify/Dnic/issues"
"url": "https://github.com/nerdify/dnic/issues"
},
"homepage": "https://github.com/nerdify/Dnic#readme",
"homepage": "https://github.com/nerdify/dnic#readme",
"devDependencies": {
"eslint": "^6.4.0",
"eslint-plugin-import": "^2.18.2"
}
"ava": "2.4.0",
"microbundle": "0.11.0",
"np": "5.1.0",
"xo": "0.24.0"
},
"publishConfig": {
"access": "public"
},
"xo": {
"prettier": true
}
}
12 changes: 12 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export const dnic = dni => {
// ([0-6][0-9]{2})-([0-2][0-9]|3[0-1])(0[1-9]|1[0-2])([0-9]{2})-([0-9]{4}[A-X])
const regex = /([0-6][d]{2})-([0-2][d]|3[0-1])(0[1-9]|1[0-2])([d]{2})-([d]{4}[A-X])/

return regex.test(dni)
}

export const dnicWithDateValidation = dni => {
if (!dni) {
return null
}
}
Loading

0 comments on commit 20f0452

Please sign in to comment.