aboutsummaryrefslogtreecommitdiff
path: root/node_modules/braces/lib/expand.js
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-06-04 08:51:19 +0200
committerMinteck <contact@minteck.org>2022-06-04 08:51:19 +0200
commitb22f6770c8bd084d66950655203c61dd701b3d90 (patch)
tree873d7fb19584ec2709b95cc1ca05a1fc7cfd0fc4 /node_modules/braces/lib/expand.js
parent383285ecd5292bf9a825e05904955b937de84cc9 (diff)
downloadequestriadb-b22f6770c8bd084d66950655203c61dd701b3d90.tar.gz
equestriadb-b22f6770c8bd084d66950655203c61dd701b3d90.tar.bz2
equestriadb-b22f6770c8bd084d66950655203c61dd701b3d90.zip
Remove node_modules
Diffstat (limited to 'node_modules/braces/lib/expand.js')
-rw-r--r--node_modules/braces/lib/expand.js113
1 files changed, 0 insertions, 113 deletions
diff --git a/node_modules/braces/lib/expand.js b/node_modules/braces/lib/expand.js
deleted file mode 100644
index 376c748..0000000
--- a/node_modules/braces/lib/expand.js
+++ /dev/null
@@ -1,113 +0,0 @@
-'use strict';
-
-const fill = require('fill-range');
-const stringify = require('./stringify');
-const utils = require('./utils');
-
-const append = (queue = '', stash = '', enclose = false) => {
- let result = [];
-
- queue = [].concat(queue);
- stash = [].concat(stash);
-
- if (!stash.length) return queue;
- if (!queue.length) {
- return enclose ? utils.flatten(stash).map(ele => `{${ele}}`) : stash;
- }
-
- for (let item of queue) {
- if (Array.isArray(item)) {
- for (let value of item) {
- result.push(append(value, stash, enclose));
- }
- } else {
- for (let ele of stash) {
- if (enclose === true && typeof ele === 'string') ele = `{${ele}}`;
- result.push(Array.isArray(ele) ? append(item, ele, enclose) : (item + ele));
- }
- }
- }
- return utils.flatten(result);
-};
-
-const expand = (ast, options = {}) => {
- let rangeLimit = options.rangeLimit === void 0 ? 1000 : options.rangeLimit;
-
- let walk = (node, parent = {}) => {
- node.queue = [];
-
- let p = parent;
- let q = parent.queue;
-
- while (p.type !== 'brace' && p.type !== 'root' && p.parent) {
- p = p.parent;
- q = p.queue;
- }
-
- if (node.invalid || node.dollar) {
- q.push(append(q.pop(), stringify(node, options)));
- return;
- }
-
- if (node.type === 'brace' && node.invalid !== true && node.nodes.length === 2) {
- q.push(append(q.pop(), ['{}']));
- return;
- }
-
- if (node.nodes && node.ranges > 0) {
- let args = utils.reduce(node.nodes);
-
- if (utils.exceedsLimit(...args, options.step, rangeLimit)) {
- throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.');
- }
-
- let range = fill(...args, options);
- if (range.length === 0) {
- range = stringify(node, options);
- }
-
- q.push(append(q.pop(), range));
- node.nodes = [];
- return;
- }
-
- let enclose = utils.encloseBrace(node);
- let queue = node.queue;
- let block = node;
-
- while (block.type !== 'brace' && block.type !== 'root' && block.parent) {
- block = block.parent;
- queue = block.queue;
- }
-
- for (let i = 0; i < node.nodes.length; i++) {
- let child = node.nodes[i];
-
- if (child.type === 'comma' && node.type === 'brace') {
- if (i === 1) queue.push('');
- queue.push('');
- continue;
- }
-
- if (child.type === 'close') {
- q.push(append(q.pop(), queue, enclose));
- continue;
- }
-
- if (child.value && child.type !== 'open') {
- queue.push(append(queue.pop(), child.value));
- continue;
- }
-
- if (child.nodes) {
- walk(child, node);
- }
- }
-
- return queue;
- };
-
- return utils.flatten(walk(ast));
-};
-
-module.exports = expand;