diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2026-05-18 23:10:59 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2026-05-18 23:41:44 +0800 |
| commit | fc87c009806dcc98867f6b58efe29b042aa01dee (patch) | |
| tree | 8f59b3f4a5b66e9dfef2d40c8d318e258a521228 /node_modules/reduce-function-call | |
| parent | 3336b2356ee6152d9c6ae59bd9b87ccbc0958407 (diff) | |
node: updatemain
Diffstat (limited to 'node_modules/reduce-function-call')
10 files changed, 0 insertions, 465 deletions
diff --git a/node_modules/reduce-function-call/CHANGELOG.md b/node_modules/reduce-function-call/CHANGELOG.md deleted file mode 100755 index 3c9b0d78..00000000 --- a/node_modules/reduce-function-call/CHANGELOG.md +++ /dev/null @@ -1,16 +0,0 @@ -# 1.0.3 - 2019-09-12 - -- Bump `balanced-match` dependency version to 1.0.0 - -# 1.0.2 - 2016-11-28 - -- Bump `balanced-match` dependency version -([postcss-cssnext/#327](https://github.com/MoOx/postcss-cssnext/issues/327) - @wtgtybhertgeghgtwtg). - -# 1.0.1 - 2014-08-06 - -* Fix issue with regex and nested call - -# 1.0.0 - 2014-08-06 - -First release diff --git a/node_modules/reduce-function-call/LICENSE b/node_modules/reduce-function-call/LICENSE deleted file mode 100755 index 40f6e9e5..00000000 --- a/node_modules/reduce-function-call/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Maxime Thirouin - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/reduce-function-call/README.md b/node_modules/reduce-function-call/README.md deleted file mode 100755 index 6ded55c1..00000000 --- a/node_modules/reduce-function-call/README.md +++ /dev/null @@ -1,88 +0,0 @@ -# reduce-function-call [](https://travis-ci.org/MoOx/reduce-function-call) - -> Reduce function calls in a string, using a callback - ---- - -[Professionally supported reduce-function-call is now available](https://tidelift.com/subscription/pkg/npm-reduce-function-call?utm_source=npm-reduce-function-call&utm_medium=referral&utm_campaign=readme) - ---- - -## Installation - -```console -npm install reduce-function-call -``` - -## Usage - -```js -var reduceFunctionCall = require("reduce-function-call") - -reduceFunctionCall("foo(1)", "foo", function(body) { - // body === "1" - return parseInt(body, 10) + 1 -}) -// "2" - -var nothingOrUpper = function(body, functionIdentifier) { - // ignore empty value - if (body === "") { - return functionIdentifier + "()" - } - - return body.toUpperCase() -} - -reduceFunctionCall("bar()", "bar", nothingOrUpper) -// "bar()" - -reduceFunctionCall("upper(baz)", "upper", nothingOrUpper) -// "BAZ" - -reduceFunctionCall("math(math(2 + 2) * 4 + math(2 + 2)) and other things", "math", function(body, functionIdentifier, call) { - try { - return eval(body) - } - catch (e) { - return call - } -}) -// "20 and other things" - -reduceFunctionCall("sha bla blah() blaa bla() abla() aabla() blaaa()", /\b([a-z]?bla[a-z]?)\(/, function(body, functionIdentifier) { - if (functionIdentifier === "bla") { - return "ABRACADABRA" - } - return functionIdentifier.replace("bla", "!") -} -// "sha bla !h blaa ABRACADABRA a! aabla() blaaa()" -``` - -See [unit tests](test/index.js) for others examples. - -## Contributing - -Work on a branch, install dev-dependencies, respect coding style & run tests before submitting a bug fix or a feature. - -```console -git clone https://github.com/MoOx/reduce-function-call.git -git checkout -b patch-1 -npm install -npm test -``` - ---- - -## [Changelog](CHANGELOG.md) - -## [License](LICENSE) - ---- - -## Security contact information - -To report a security vulnerability, please use the -[Tidelift security contact](https://tidelift.com/security). Tidelift will -coordinate the fix and disclosure. - diff --git a/node_modules/reduce-function-call/index.js b/node_modules/reduce-function-call/index.js deleted file mode 100755 index c20effaa..00000000 --- a/node_modules/reduce-function-call/index.js +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Module dependencies - */ -var balanced = require("balanced-match") - -/** - * Expose `reduceFunctionCall` - * - * @type {Function} - */ -module.exports = reduceFunctionCall - -/** - * Walkthrough all expressions, evaluate them and insert them into the declaration - * - * @param {Array} expressions - * @param {Object} declaration - */ - -function reduceFunctionCall(string, functionRE, callback) { - var call = string - return getFunctionCalls(string, functionRE).reduce(function(string, obj) { - return string.replace(obj.functionIdentifier + "(" + obj.matches.body + ")", evalFunctionCall(obj.matches.body, obj.functionIdentifier, callback, call, functionRE)) - }, string) -} - -/** - * Parses expressions in a value - * - * @param {String} value - * @returns {Array} - * @api private - */ - -function getFunctionCalls(call, functionRE) { - var expressions = [] - - var fnRE = typeof functionRE === "string" ? new RegExp("\\b(" + functionRE + ")\\(") : functionRE - do { - var searchMatch = fnRE.exec(call) - if (!searchMatch) { - return expressions - } - if (searchMatch[1] === undefined) { - throw new Error("Missing the first couple of parenthesis to get the function identifier in " + functionRE) - } - var fn = searchMatch[1] - var startIndex = searchMatch.index - var matches = balanced("(", ")", call.substring(startIndex)) - - if (!matches || matches.start !== searchMatch[0].length - 1) { - throw new SyntaxError(fn + "(): missing closing ')' in the value '" + call + "'") - } - - expressions.push({matches: matches, functionIdentifier: fn}) - call = matches.post - } - while (fnRE.test(call)) - - return expressions -} - -/** - * Evaluates an expression - * - * @param {String} expression - * @returns {String} - * @api private - */ - -function evalFunctionCall (string, functionIdentifier, callback, call, functionRE) { - // allow recursivity - return callback(reduceFunctionCall(string, functionRE, callback), functionIdentifier, call) -} diff --git a/node_modules/reduce-function-call/node_modules/balanced-match/.github/FUNDING.yml b/node_modules/reduce-function-call/node_modules/balanced-match/.github/FUNDING.yml deleted file mode 100644 index cea8b16e..00000000 --- a/node_modules/reduce-function-call/node_modules/balanced-match/.github/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ -tidelift: "npm/balanced-match" -patreon: juliangruber diff --git a/node_modules/reduce-function-call/node_modules/balanced-match/LICENSE.md b/node_modules/reduce-function-call/node_modules/balanced-match/LICENSE.md deleted file mode 100644 index 2cdc8e41..00000000 --- a/node_modules/reduce-function-call/node_modules/balanced-match/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -(MIT) - -Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/reduce-function-call/node_modules/balanced-match/README.md b/node_modules/reduce-function-call/node_modules/balanced-match/README.md deleted file mode 100644 index d2a48b6b..00000000 --- a/node_modules/reduce-function-call/node_modules/balanced-match/README.md +++ /dev/null @@ -1,97 +0,0 @@ -# balanced-match - -Match balanced string pairs, like `{` and `}` or `<b>` and `</b>`. Supports regular expressions as well! - -[](http://travis-ci.org/juliangruber/balanced-match) -[](https://www.npmjs.org/package/balanced-match) - -[](https://ci.testling.com/juliangruber/balanced-match) - -## Example - -Get the first matching pair of braces: - -```js -var balanced = require('balanced-match'); - -console.log(balanced('{', '}', 'pre{in{nested}}post')); -console.log(balanced('{', '}', 'pre{first}between{second}post')); -console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post')); -``` - -The matches are: - -```bash -$ node example.js -{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' } -{ start: 3, - end: 9, - pre: 'pre', - body: 'first', - post: 'between{second}post' } -{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' } -``` - -## API - -### var m = balanced(a, b, str) - -For the first non-nested matching pair of `a` and `b` in `str`, return an -object with those keys: - -* **start** the index of the first match of `a` -* **end** the index of the matching `b` -* **pre** the preamble, `a` and `b` not included -* **body** the match, `a` and `b` not included -* **post** the postscript, `a` and `b` not included - -If there's no match, `undefined` will be returned. - -If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']` and `{a}}` will match `['', 'a', '}']`. - -### var r = balanced.range(a, b, str) - -For the first non-nested matching pair of `a` and `b` in `str`, return an -array with indexes: `[ <a index>, <b index> ]`. - -If there's no match, `undefined` will be returned. - -If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]` and `{a}}` will match `[0, 2]`. - -## Installation - -With [npm](https://npmjs.org) do: - -```bash -npm install balanced-match -``` - -## Security contact information - -To report a security vulnerability, please use the -[Tidelift security contact](https://tidelift.com/security). -Tidelift will coordinate the fix and disclosure. - -## License - -(MIT) - -Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/reduce-function-call/node_modules/balanced-match/index.js b/node_modules/reduce-function-call/node_modules/balanced-match/index.js deleted file mode 100644 index c67a6460..00000000 --- a/node_modules/reduce-function-call/node_modules/balanced-match/index.js +++ /dev/null @@ -1,62 +0,0 @@ -'use strict'; -module.exports = balanced; -function balanced(a, b, str) { - if (a instanceof RegExp) a = maybeMatch(a, str); - if (b instanceof RegExp) b = maybeMatch(b, str); - - var r = range(a, b, str); - - return r && { - start: r[0], - end: r[1], - pre: str.slice(0, r[0]), - body: str.slice(r[0] + a.length, r[1]), - post: str.slice(r[1] + b.length) - }; -} - -function maybeMatch(reg, str) { - var m = str.match(reg); - return m ? m[0] : null; -} - -balanced.range = range; -function range(a, b, str) { - var begs, beg, left, right, result; - var ai = str.indexOf(a); - var bi = str.indexOf(b, ai + 1); - var i = ai; - - if (ai >= 0 && bi > 0) { - if(a===b) { - return [ai, bi]; - } - begs = []; - left = str.length; - - while (i >= 0 && !result) { - if (i == ai) { - begs.push(i); - ai = str.indexOf(a, i + 1); - } else if (begs.length == 1) { - result = [ begs.pop(), bi ]; - } else { - beg = begs.pop(); - if (beg < left) { - left = beg; - right = bi; - } - - bi = str.indexOf(b, i + 1); - } - - i = ai < bi && ai >= 0 ? ai : bi; - } - - if (begs.length) { - result = [ left, right ]; - } - } - - return result; -} diff --git a/node_modules/reduce-function-call/node_modules/balanced-match/package.json b/node_modules/reduce-function-call/node_modules/balanced-match/package.json deleted file mode 100644 index ce6073e0..00000000 --- a/node_modules/reduce-function-call/node_modules/balanced-match/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "balanced-match", - "description": "Match balanced character pairs, like \"{\" and \"}\"", - "version": "1.0.2", - "repository": { - "type": "git", - "url": "git://github.com/juliangruber/balanced-match.git" - }, - "homepage": "https://github.com/juliangruber/balanced-match", - "main": "index.js", - "scripts": { - "test": "tape test/test.js", - "bench": "matcha test/bench.js" - }, - "devDependencies": { - "matcha": "^0.7.0", - "tape": "^4.6.0" - }, - "keywords": [ - "match", - "regexp", - "test", - "balanced", - "parse" - ], - "author": { - "name": "Julian Gruber", - "email": "mail@juliangruber.com", - "url": "http://juliangruber.com" - }, - "license": "MIT", - "testling": { - "files": "test/*.js", - "browsers": [ - "ie/8..latest", - "firefox/20..latest", - "firefox/nightly", - "chrome/25..latest", - "chrome/canary", - "opera/12..latest", - "opera/next", - "safari/5.1..latest", - "ipad/6.0..latest", - "iphone/6.0..latest", - "android-browser/4.2..latest" - ] - } -} diff --git a/node_modules/reduce-function-call/package.json b/node_modules/reduce-function-call/package.json deleted file mode 100755 index cb4d432e..00000000 --- a/node_modules/reduce-function-call/package.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "reduce-function-call", - "version": "1.0.3", - "description": "Reduce function calls in a string, using a callback", - "keywords": [ - "string", - "reduce", - "replacement", - "function", - "call", - "eval", - "interpret" - ], - "author": "MoOx", - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/MoOx/reduce-function-call.git" - }, - "files": [ - "CHANGELOG.md", - "LICENSE", - "README.md", - "index.js" - ], - "dependencies": { - "balanced-match": "^1.0.0" - }, - "devDependencies": { - "npmpub": "^4.1.0", - "tape": "^4.0.3" - }, - "scripts": { - "test": "tape test", - "release": "npmpub" - } -} |
