This commit is contained in:
2024-03-22 03:47:51 +05:30
parent 8bcf3d211e
commit 89819f6fe2
28440 changed files with 3211033 additions and 2 deletions

7
node_modules/parse-numeric-range/.travis.yml generated vendored Normal file
View File

@@ -0,0 +1,7 @@
language: node_js
node_js:
- 9
- node
branches:
only:
- master

13
node_modules/parse-numeric-range/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,13 @@
Copyright (c) 2014, Euank <euank@euank.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

53
node_modules/parse-numeric-range/README.md generated vendored Normal file
View File

@@ -0,0 +1,53 @@
node-parse-numeric-range
========================
Parses expressions like 1-10,20-30. Returns an energetic (as opposed to lazy) array.
## Supported Expressions
Comprehensive supported expression examples:
| Expression | result |
|:----------:|:------------:|
| | [] |
| 1 | [1] |
| 1,2 | [1,2] |
| -10 | [-10] |
| -3,-3 |[-3, -3] |
| -1-2,-2 |[-1,0,1,2,-2] |
| -1--2 |[-1,-2] |
| -1..2,-2 |[-1,0,1,2,-2] |
| -1...3,-2 |[-1,0,1,2,-2] |
| 1⋯3 |[1,2] |
| 1…3 |[1,2] |
| 1‥3 |[1,2,3] |
What's this useful for? Well, letting users input these sorts of things and then
making them programmatically useful.
## Usage
First, `npm install parse-numeric-range`.
```javascript
const rangeParser = require("parse-numeric-range");
const numbers = rangeParser("4,6,8-10,12,14..16,18,20...23");
console.log(
`The first ${numbers.length} composite numbers are: ${numbers.join(", ")}`,
);
```
### ES6
```jsx
import rangeParser from "parse-numeric-range";
const numbers = rangeParser("4,6,8-10,12,14..16,18,20...23");
console.log(
`The first ${numbers.length} composite numbers are: ${numbers.join(", ")}`,
);
```

6
node_modules/parse-numeric-range/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,6 @@
/**
* Parses expressions like `1-10,20-30`. Returns an energetic (as opposed to lazy) array.
* @param expression a numeric range expression
*/
declare function parse(expression: string): number[];
export = parse;

36
node_modules/parse-numeric-range/index.js generated vendored Normal file
View File

@@ -0,0 +1,36 @@
/**
* @param {string} string The string to parse
* @returns {Array<number>} Returns an energetic array.
*/
function parsePart(string) {
let res = [];
let m;
for (let str of string.split(",").map((str) => str.trim())) {
// just a number
if (/^-?\d+$/.test(str)) {
res.push(parseInt(str, 10));
} else if (
(m = str.match(/^(-?\d+)(-|\.\.\.?|\u2025|\u2026|\u22EF)(-?\d+)$/))
) {
// 1-5 or 1..5 (equivalent) or 1...5 (doesn't include 5)
let [_, lhs, sep, rhs] = m;
if (lhs && rhs) {
lhs = parseInt(lhs);
rhs = parseInt(rhs);
const incr = lhs < rhs ? 1 : -1;
// Make it inclusive by moving the right 'stop-point' away by one.
if (sep === "-" || sep === ".." || sep === "\u2025") rhs += incr;
for (let i = lhs; i !== rhs; i += incr) res.push(i);
}
}
}
return res;
}
exports.default = parsePart;
module.exports = parsePart;

28
node_modules/parse-numeric-range/package.json generated vendored Normal file
View File

@@ -0,0 +1,28 @@
{
"name": "parse-numeric-range",
"version": "1.3.0",
"description": "Takes a string, such as \"1,2,3-10,5-8\" and turns it into an array of numbers",
"main": "index.js",
"scripts": {
"test": "./node_modules/mocha/bin/mocha --require esm"
},
"keywords": [
"parse",
"numbers",
"ranges",
"utility",
"arrays"
],
"author": "Euan Kemp",
"license": "ISC",
"homepage": "https://github.com/euank/node-parse-numeric-range",
"repository": {
"type": "git",
"url": "https://github.com/euank/node-parse-numeric-range.git"
},
"devDependencies": {
"chai": "*",
"mocha": "*",
"esm": "*"
}
}

59
node_modules/parse-numeric-range/test/test.js generated vendored Normal file
View File

@@ -0,0 +1,59 @@
import { expect } from 'chai'
import strparse from '../index.js'
function peq(x, y) {
expect(strparse(x)).to.eql(y);
}
describe('range-parser', function(){
describe('#parse', function(){
it('should parse 1', function() {
peq('1', [1]);
});
it('should parse 1,1', function(){
peq('1,1', [1,1]);
});
it('should parse 1-5', function(){
peq('1-5', [1,2,3,4,5]);
});
it('should parse 5-1', function(){
peq('5-1', [5,4,3,2,1]);
});
it('should parse 1-3,5-6', function(){
peq('1-3,5-6', [1,2,3,5,6]);
});
it('should parse 10..15', function(){
peq('10..15', [10,11,12,13,14,15]);
});
it('should parse 10...15', function(){
peq('10...15', [10,11,12,13,14]);
});
it('should parse 10..12,13...15,2,8', function(){
peq('10..12,13...15,2,8', [10,11,12,13,14,2,8]);
});
it('should parse ""', function(){
peq('', []);
});
it('should parse -5', function(){
peq('-5', [-5]);
});
it('should parse -5--10', function(){
peq('-5--10', [-5,-6,-7,-8,-9,-10]);
});
it('should parse -1..2,-1...2', function(){
peq('-1..2,-1...2', [-1,0,1,2,-1,0,1]);
});
it('should parse 1‥3', function() {
peq('1‥3', [1,2,3]);
});
it('should parse 1⋯3', function() {
peq('1⋯3', [1,2]);
});
it('should parse 1…3', function() {
peq('1…3', [1,2]);
});
it('should parse ranges with a space in between', function() {
peq('1-2, 3-4', [1,2,3,4]);
});
});
});