diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2024-08-30 17:21:18 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2024-08-30 17:21:18 +0800 |
| commit | efbc2ffe6a1ee5ec38a4396305561d6515d0943e (patch) | |
| tree | 2b4c94f18f2c792dfda813050755d5c0273fae22 /node_modules/fill-range | |
| parent | 43acceb75957c880a5ba5a31aae221394a36d5f6 (diff) | |
node fixes, updates
Diffstat (limited to 'node_modules/fill-range')
| -rw-r--r-- | node_modules/fill-range/index.js | 9 | ||||
| -rw-r--r-- | node_modules/fill-range/package.json | 11 |
2 files changed, 12 insertions, 8 deletions
diff --git a/node_modules/fill-range/index.js b/node_modules/fill-range/index.js index 97ce35a5..ddb212ee 100644 --- a/node_modules/fill-range/index.js +++ b/node_modules/fill-range/index.js @@ -60,7 +60,7 @@ const toMaxLen = (input, maxLength) => { return negative ? ('-' + input) : input; }; -const toSequence = (parts, options) => { +const toSequence = (parts, options, maxLen) => { parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0); parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0); @@ -70,11 +70,11 @@ const toSequence = (parts, options) => { let result; if (parts.positives.length) { - positives = parts.positives.join('|'); + positives = parts.positives.map(v => toMaxLen(String(v), maxLen)).join('|'); } if (parts.negatives.length) { - negatives = `-(${prefix}${parts.negatives.join('|')})`; + negatives = `-(${prefix}${parts.negatives.map(v => toMaxLen(String(v), maxLen)).join('|')})`; } if (positives && negatives) { @@ -172,7 +172,7 @@ const fillNumbers = (start, end, step = 1, options = {}) => { if (options.toRegex === true) { return step > 1 - ? toSequence(parts, options) + ? toSequence(parts, options, maxLen) : toRegex(range, null, { wrap: false, ...options }); } @@ -184,7 +184,6 @@ const fillLetters = (start, end, step = 1, options = {}) => { return invalidRange(start, end, options); } - let format = options.transform || (val => String.fromCharCode(val)); let a = `${start}`.charCodeAt(0); let b = `${end}`.charCodeAt(0); diff --git a/node_modules/fill-range/package.json b/node_modules/fill-range/package.json index 07d30767..582357fb 100644 --- a/node_modules/fill-range/package.json +++ b/node_modules/fill-range/package.json @@ -1,7 +1,7 @@ { "name": "fill-range", "description": "Fill in a range of numbers or letters, optionally passing an increment or `step` to use, or create a regex-compatible range with `options.toRegex`", - "version": "7.0.1", + "version": "7.1.1", "homepage": "https://github.com/jonschlinkert/fill-range", "author": "Jon Schlinkert (https://github.com/jonschlinkert)", "contributors": [ @@ -24,14 +24,19 @@ "node": ">=8" }, "scripts": { - "test": "mocha" + "lint": "eslint --cache --cache-location node_modules/.cache/.eslintcache --report-unused-disable-directives --ignore-path .gitignore .", + "mocha": "mocha --reporter dot", + "test": "npm run lint && npm run mocha", + "test:ci": "npm run test:cover", + "test:cover": "nyc npm run mocha" }, "dependencies": { "to-regex-range": "^5.0.1" }, "devDependencies": { "gulp-format-md": "^2.0.0", - "mocha": "^6.1.1" + "mocha": "^6.1.1", + "nyc": "^15.1.0" }, "keywords": [ "alpha", |
