Comparing version 0.3.0 to 1.0.0
45
gex.js
@@ -1,4 +0,4 @@ | ||
/* Copyright (c) 2011-2018 Richard Rodger, MIT License */ | ||
/* jshint node:true, asi:true, eqnull:true */ | ||
/* Copyright (c) 2011-2019 Richard Rodger, MIT License */ | ||
// eslint-disable-next-line | ||
;(function() { | ||
@@ -9,8 +9,2 @@ 'use strict' | ||
var has_require = typeof require !== 'undefined' | ||
var _ = root._ || (has_require && require('lodash')) | ||
if (!_) | ||
throw new Error('gex requires underscore, see http://underscorejs.org') | ||
function Gex(gexspec) { | ||
@@ -20,3 +14,3 @@ var self = this | ||
function dodgy(obj) { | ||
return _.isNull(obj) || _.isNaN(obj) || _.isUndefined(obj) | ||
return null == obj || void 0 == obj || Number.isNaN(obj) | ||
} | ||
@@ -26,3 +20,3 @@ | ||
var gexstr = '' + gexexp | ||
if (_.isNull(gexexp) || _.isNaN(gexexp) || _.isUndefined(gexexp)) { | ||
if (dodgy(gexexp)) { | ||
gexstr = '' | ||
@@ -36,3 +30,3 @@ } | ||
var hasmatch = false | ||
var gexstrs = _.keys(gexmap) | ||
var gexstrs = Object.keys(gexmap) | ||
@@ -51,11 +45,12 @@ for (var i = 0; i < gexstrs.length && !hasmatch; i++) { | ||
self.on = function(obj) { | ||
var typeof_obj = typeof obj | ||
if ( | ||
_.isString(obj) || | ||
_.isNumber(obj) || | ||
_.isBoolean(obj) || | ||
_.isDate(obj) || | ||
_.isRegExp(obj) | ||
'string' === typeof_obj || | ||
'number' === typeof_obj || | ||
'boolean' === typeof_obj || | ||
obj instanceof Date || | ||
obj instanceof RegExp | ||
) { | ||
return match(obj) ? obj : null | ||
} else if (_.isArray(obj) || _.isArguments(obj)) { | ||
} else if (Array.isArray(obj)) { | ||
var out = [] | ||
@@ -68,3 +63,3 @@ for (var i = 0; i < obj.length; i++) { | ||
return out | ||
} else if (_.isObject(obj)) { | ||
} else if ('object' === typeof_obj) { | ||
var outobj = {} | ||
@@ -100,4 +95,4 @@ for (var p in obj) { | ||
// escapes ** and *? | ||
gs = gs.replace(/\[\\s\\S\]\*\[\\s\\S\]\*/g, '\\\*') | ||
gs = gs.replace(/\[\\s\\S\]\*\[\\s\\S\]/g, '\\\?') | ||
gs = gs.replace(/\[\\s\\S\]\*\[\\s\\S\]\*/g, '\\*') | ||
gs = gs.replace(/\[\\s\\S\]\*\[\\s\\S\]/g, '\\?') | ||
@@ -108,4 +103,4 @@ gs = '^' + gs + '$' | ||
} else { | ||
var gexstrs = _.keys(gexmap) | ||
return 1 == gexstrs.length ? gexmap[gexstrs[0]] : _.clone(gexmap) | ||
var gexstrs = Object.keys(gexmap) | ||
return 1 == gexstrs.length ? gexmap[gexstrs[0]] : { ...gexmap } | ||
} | ||
@@ -121,3 +116,3 @@ } | ||
self.toString = function() { | ||
return desc ? desc : (desc = 'gex[' + _.keys(gexmap) + ']') | ||
return desc ? desc : (desc = 'gex[' + Object.keys(gexmap) + ']') | ||
} | ||
@@ -129,7 +124,7 @@ | ||
var gexstrs = _.isArray(gexspec) ? gexspec : [gexspec] | ||
var gexstrs = Array.isArray(gexspec) ? gexspec : [gexspec] | ||
var gexmap = {} | ||
var desc | ||
_.each(gexstrs, function(str) { | ||
gexstrs.forEach(function(str) { | ||
str = clean(str) | ||
@@ -136,0 +131,0 @@ var re = self.re(str) |
{ | ||
"name": "gex", | ||
"description": "Glob expressions for JavaScript", | ||
"scripts": { | ||
"test": "lab -v -L -P test -t 85", | ||
"coveralls": "lab -s -P test -r lcov -I URL,URLSearchParams | coveralls", | ||
"prettier": "prettier --write --no-semi --single-quote gex.js lib/*.js test/*.js", | ||
"clean": "rm -rf node_modules yarn.lock package-lock.json", | ||
"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 clean && npm i && npm run prettier && npm test && npm run repo-tag && npm publish --registry http://registry.npmjs.org" | ||
}, | ||
"keywords": [ | ||
@@ -12,3 +21,3 @@ "glob", | ||
], | ||
"version": "0.3.0", | ||
"version": "1.0.0", | ||
"homepage": "https://github.com/rjrodger/gex", | ||
@@ -20,5 +29,3 @@ "author": "Richard Rodger (http://richardrodger.com/)", | ||
"license": "MIT", | ||
"dependencies": { | ||
"lodash": "4.17" | ||
}, | ||
"dependencies": {}, | ||
"main": "gex.js", | ||
@@ -32,17 +39,9 @@ "repository": { | ||
"LICENSE.txt", | ||
"gex.js", | ||
"gex-min.js", | ||
"gex-min.map" | ||
"gex.js" | ||
], | ||
"scripts": { | ||
"test": "lab -v -P test -t 80 -I URL,URLSearchParams", | ||
"coveralls": "lab -s -P test -r lcov -I URL,URLSearchParams | coveralls", | ||
"prettier": "prettier --write --no-semi --single-quote gex.js lib/*.js test/*.js" | ||
}, | ||
"devDependencies": { | ||
"serve": "6", | ||
"code": "4", | ||
"coveralls": "3", | ||
"lab": "14" | ||
"@hapi/code": "^7.0.0", | ||
"@hapi/lab": "^21.0.0", | ||
"coveralls": "^3.0.7" | ||
} | ||
} |
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
3
0
9055
4
119
- Removedlodash@4.17
- Removedlodash@4.17.21(transitive)