Comparing version 2.0.2 to 3.0.0
28
norma.js
@@ -5,2 +5,4 @@ /* Copyright (c) 2014-2015 Richard Rodger, MIT License */ | ||
// NOTE: TO BE RETIRED | ||
// TODO: allow _ and $ in named args !!! doh! | ||
@@ -26,3 +28,3 @@ | ||
onfail: 'throw', | ||
desclen: 33 | ||
desclen: 33, | ||
} | ||
@@ -47,3 +49,3 @@ | ||
var i = 0 | ||
respec.forEach(function(entry) { | ||
respec.forEach(function (entry) { | ||
restr.push('(') | ||
@@ -58,3 +60,3 @@ | ||
entry.type.or.forEach(function(or) { | ||
entry.type.or.forEach(function (or) { | ||
restr.push('|') | ||
@@ -96,3 +98,3 @@ restr.push('(') | ||
respec: respec, | ||
reindex: reindex | ||
reindex: reindex, | ||
} | ||
@@ -223,3 +225,3 @@ | ||
args.forEach(function(arg) { | ||
args.forEach(function (arg) { | ||
if ('string' === typeof arg) { | ||
@@ -230,3 +232,7 @@ desc.push('s') | ||
// Need to check for integer first. | ||
else if (!isNaN(arg) && (arg | 0) === parseFloat(arg)) { | ||
else if ( | ||
'object' != typeof arg && | ||
!isNaN(arg) && | ||
(arg | 0) === parseFloat(arg) | ||
) { | ||
desc.push('i') | ||
@@ -278,3 +284,3 @@ } else if (_.isNaN(arg)) { | ||
args.forEach(function(arg) { | ||
args.forEach(function (arg) { | ||
var str = util.inspect(arg).substring(0, options.desclen) | ||
@@ -307,3 +313,3 @@ desc.push(str) | ||
// #### Primary API | ||
module.exports = function(spec, options, rawargs) { | ||
module.exports = function (spec, options, rawargs) { | ||
var specdef = compile(spec) | ||
@@ -315,9 +321,9 @@ return handle(specdef, options, rawargs) | ||
// _toString_ shows you the constructed regexp (for debugging). | ||
module.exports.compile = function(spec) { | ||
module.exports.compile = function (spec) { | ||
var specdef = compile(spec) | ||
var out = function(options, rawargs) { | ||
var out = function (options, rawargs) { | ||
return handle(specdef, options, rawargs) | ||
} | ||
out.toString = function() { | ||
out.toString = function () { | ||
return util.inspect({ spec: specdef.spec, re: '' + specdef.re }) | ||
@@ -324,0 +330,0 @@ } |
{ | ||
"name": "norma", | ||
"version": "2.0.2", | ||
"version": "3.0.0", | ||
"description": "A function argument organizer", | ||
@@ -10,6 +10,6 @@ "main": "norma.js", | ||
"clean": "rm -rf node_modules yarn.lock package-lock.json", | ||
"prettier": "prettier --write --no-semi --single-quote norma.js lib/*.js test/*.js", | ||
"prettier": "prettier --write --no-semi --single-quote norma.js norma.js test/*.js", | ||
"reset": "npm run clean && npm i && npm test", | ||
"repo-tag": "REPO_VERSION=`node -e \"console.log(require('./package').version)\"` && echo TAG: v$REPO_VERSION && git commit -a -m v$REPO_VERSION && git push && git tag v$REPO_VERSION && git push --tags;", | ||
"repo-publish": "npm run prettier && npm test && npm run repo-tag && npm publish --registry http://registry.npmjs.org " | ||
"repo-publish": "npm run prettier && npm test && npm run repo-tag && npm publish --registry https://registry.npmjs.org " | ||
}, | ||
@@ -38,10 +38,11 @@ "repository": { | ||
"devDependencies": { | ||
"docco": "^0.8.0", | ||
"jshint": "^2.10.3", | ||
"mocha": "^6.2.2", | ||
"docco": "^0.9.1", | ||
"jshint": "^2.13.6", | ||
"mocha": "^10.2.0", | ||
"pegjs": "^0.10.0", | ||
"uglify-js": "^3.7.1" | ||
"prettier": "^2.8.8", | ||
"uglify-js": "^3.17.4" | ||
}, | ||
"dependencies": { | ||
"eraro": "^2.0.0", | ||
"eraro": "^2.1.0", | ||
"lodash.isarguments": "^3.1.0", | ||
@@ -48,0 +49,0 @@ "lodash.isdate": "^4.0.1", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55054
1322
6
Updatederaro@^2.1.0