From fee47f6414cc3ae9a88f3ee0ed20f1d6f2d9f556 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Sat, 14 Oct 2023 15:58:02 +0800 Subject: added plugin from postcss: postcss-fixes rucksack-css --- node_modules/flatten/LICENSE | 21 +++++++++++++++++++++ node_modules/flatten/README.md | 34 ++++++++++++++++++++++++++++++++++ node_modules/flatten/index.js | 23 +++++++++++++++++++++++ node_modules/flatten/package.json | 35 +++++++++++++++++++++++++++++++++++ node_modules/flatten/test.js | 25 +++++++++++++++++++++++++ 5 files changed, 138 insertions(+) create mode 100644 node_modules/flatten/LICENSE create mode 100644 node_modules/flatten/README.md create mode 100644 node_modules/flatten/index.js create mode 100644 node_modules/flatten/package.json create mode 100644 node_modules/flatten/test.js (limited to 'node_modules/flatten') diff --git a/node_modules/flatten/LICENSE b/node_modules/flatten/LICENSE new file mode 100644 index 00000000..54a689b8 --- /dev/null +++ b/node_modules/flatten/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Joshua Holbrook + +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/flatten/README.md b/node_modules/flatten/README.md new file mode 100644 index 00000000..7b0a3b69 --- /dev/null +++ b/node_modules/flatten/README.md @@ -0,0 +1,34 @@ +# flatten + +A tiny utility to flatten arrays of arrays (of arrays, etc., recursively, infinitely or to an optional depth) into a single array of non-arrays. + +## example: + +```js +> var flatten = require('flatten'); +undefined +> flatten([1, [2, 3], [4, 5, 6], [7, [8, 9]], 10]) +[ 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 ] +> flatten([1, [2, [3, [4, [5]]]]], 2) +[ 1, + 2, + 3, + [ 4, [ 5 ] ] ] +``` + +## install: + + npm install flatten + +## license: + +MIT/X11. diff --git a/node_modules/flatten/index.js b/node_modules/flatten/index.js new file mode 100644 index 00000000..a9bd9b8c --- /dev/null +++ b/node_modules/flatten/index.js @@ -0,0 +1,23 @@ +module.exports = function flatten(list, depth) { + depth = (typeof depth == 'number') ? depth : Infinity; + + if (!depth) { + if (Array.isArray(list)) { + return list.map(function(i) { return i; }); + } + return list; + } + + return _flatten(list, 1); + + function _flatten(list, d) { + return list.reduce(function (acc, item) { + if (Array.isArray(item) && d < depth) { + return acc.concat(_flatten(item, d + 1)); + } + else { + return acc.concat(item); + } + }, []); + } +}; diff --git a/node_modules/flatten/package.json b/node_modules/flatten/package.json new file mode 100644 index 00000000..b5903d91 --- /dev/null +++ b/node_modules/flatten/package.json @@ -0,0 +1,35 @@ +{ "name": "flatten", + "version": "1.0.3", + "description": "Flatten arbitrarily nested arrays into a non-nested list of non-array items. Maintained for legacy compatibility.", + "keywords": [ + "array", + "flatten" + ], + + "author": "Joshua Holbrook (http://jesusabdullah.net)", + "homepage": "https://github.com/mk-pmb/flatten-js/#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/mk-pmb/flatten-js.git" + }, + "bugs": { + "url": "https://github.com/mk-pmb/flatten-js/issues" + }, + "contributors": [ + "M.K. (https://github.com/mk-pmb)" + ], + + "private": false, "license": "MIT", + + "scripts": { + "test": "node ./test.js" + }, + "directories": { "test": "test" }, + + "dependencies": {}, + "devDependencies": {}, + "optionalDependencies": {}, + + + "npm vs. BOM = Unexpected token": "-*- coding: UTF-8 -*-" +} diff --git a/node_modules/flatten/test.js b/node_modules/flatten/test.js new file mode 100644 index 00000000..385c27fa --- /dev/null +++ b/node_modules/flatten/test.js @@ -0,0 +1,25 @@ +var flatten = require('./index'), + util = require('util'), + assert = require('assert'); + +[ + [ [1, [ 2, 3]], [1, [2, 3]], 0], + [ [1, 2, 3 ], [1, 2, 3] ], + [ ['a', ['b', ['c']]], ['a', 'b', 'c'] ], + [ [2, [4, 6], 8, [[10]]], [2, 4, 6, 8, 10] ], + [ [1, [2, [3, [4, [5]]]]], [1, 2, 3, [4, [5]]], 2 ] // depth of 2 +].forEach(function (t) { + assert.deepEqual(flatten(t[0], t[2]), t[1], + util.format('☠☠☠☠☠☠☠☠☠ %s ☠☠☠☠☠☠☠☠☠', formatCall(t)) + ); + console.log('✓ %s', formatCall(t)); +}); + +function formatCall(t) { + if (typeof t[2] === 'undefined') { + return util.format('`flatten(%j) == %j`', t[0], t[1]); + } + else { + return util.format('`flatten(%j, %j) == %j`', t[0], t[2], t[1]); + } +} -- cgit v1.2.3