修改后台权限
This commit is contained in:
22
node_modules/object-treeify/LICENSE
generated
vendored
Normal file
22
node_modules/object-treeify/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
Copyright (c) 2019 Lukas Siemon
|
||||
|
||||
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.
|
||||
120
node_modules/object-treeify/README.md
generated
vendored
Normal file
120
node_modules/object-treeify/README.md
generated
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
# object-treeify
|
||||
|
||||
[](https://circleci.com/gh/blackflux/object-treeify)
|
||||
[](https://coveralls.io/github/blackflux/object-treeify?branch=master)
|
||||
[](https://dependabot.com)
|
||||
[](https://david-dm.org/blackflux/object-treeify)
|
||||
[](https://www.npmjs.com/package/object-treeify)
|
||||
[](https://www.npmjs.com/package/object-treeify)
|
||||
[](https://github.com/semantic-release/semantic-release)
|
||||
[](https://github.com/blackflux/js-gardener)
|
||||
|
||||
Stringify Object as tree structure
|
||||
|
||||
```
|
||||
{
|
||||
oranges: {
|
||||
'mandarin': { ├─ oranges
|
||||
clementine: null, │ └─ mandarin
|
||||
tangerine: 'so cheap and juicy!' -=> │ ├─ clementine
|
||||
} │ └─ tangerine: so cheap and juicy!
|
||||
}, └─ apples
|
||||
apples: { ├─ gala
|
||||
'gala': null, └─ pink lady
|
||||
'pink lady': null
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Project was inspired by [treeify](https://github.com/notatestuser/treeify) and works almost identical. However
|
||||
the algorithm is much shorter and faster, works without recursion and is very memory efficient. Furthermore
|
||||
the output can be sorted using a custom comparator function.
|
||||
|
||||
## Install
|
||||
|
||||
$ npm install --save object-treeify
|
||||
|
||||
## Usage
|
||||
|
||||
<!-- eslint-disable import/no-unresolved,import/no-extraneous-dependencies -->
|
||||
```js
|
||||
const treeify = require('object-treeify');
|
||||
|
||||
treeify({
|
||||
oranges: {
|
||||
mandarin: {
|
||||
clementine: null,
|
||||
tangerine: 'so cheap and juicy!'
|
||||
}
|
||||
},
|
||||
apples: {
|
||||
gala: null,
|
||||
'pink lady': null
|
||||
}
|
||||
}, {/* options */});
|
||||
|
||||
// =>
|
||||
// ├─ oranges
|
||||
// │ └─ mandarin
|
||||
// │ ├─ clementine
|
||||
// │ └─ tangerine: so cheap and juicy!
|
||||
// └─ apples
|
||||
// ├─ gala
|
||||
// └─ pink lady
|
||||
```
|
||||
|
||||
### Features
|
||||
|
||||
- Allows for custom sorting
|
||||
- Very fast and memory efficient implementation
|
||||
- Input traversed exactly once
|
||||
- Dependency free and small in size
|
||||
- Tests to verify correctness
|
||||
|
||||
## Options
|
||||
|
||||
### joined
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
By default a single string is returned. Can be set to `false` to instead return an array containing lines.
|
||||
|
||||
#### spacerNoNeighbour
|
||||
|
||||
Type: `string`<br>
|
||||
Default: ` `
|
||||
|
||||
Prefix for depth level when no further neighbour is present.
|
||||
|
||||
#### spacerNeighbour
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `│ `
|
||||
|
||||
Prefix for depth level when a further neighbour is present.
|
||||
|
||||
#### keyNoNeighbour
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `└─ `
|
||||
|
||||
Prefix for key when no further neighbour is present.
|
||||
|
||||
#### keyNeighbour
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `├─ `
|
||||
|
||||
Prefix for key when a further neighbour is present.
|
||||
|
||||
#### sortFn
|
||||
|
||||
Type: `function`<br>
|
||||
Default: `null`
|
||||
|
||||
Function that defines the key sort order. Defaults to ordering of `Object.keys(...)`, which is typically insertion order.
|
||||
|
||||
## Examples
|
||||
|
||||
More examples can be found in the tests.
|
||||
49
node_modules/object-treeify/lib/index.js
generated
vendored
Normal file
49
node_modules/object-treeify/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
"use strict";
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
const assert = console.assert;
|
||||
|
||||
const buildCtx = opts => {
|
||||
const ctx = {
|
||||
joined: true,
|
||||
spacerNoNeighbour: ' ',
|
||||
spacerNeighbour: '│ ',
|
||||
keyNoNeighbour: '└─ ',
|
||||
keyNeighbour: '├─ ',
|
||||
sortFn: null,
|
||||
...opts
|
||||
};
|
||||
assert(Object.keys(ctx).length === 6, 'Unexpected Option(s) provided');
|
||||
assert(typeof ctx.joined === 'boolean', 'Option "joined" has invalid format');
|
||||
assert(typeof ctx.spacerNoNeighbour === 'string', 'Option "spacerNoNeighbour" has invalid format');
|
||||
assert(typeof ctx.spacerNeighbour === 'string', 'Option "spacerNeighbour" has invalid format');
|
||||
assert(typeof ctx.keyNoNeighbour === 'string', 'Option "keyNoNeighbour" has invalid format');
|
||||
assert(typeof ctx.keyNeighbour === 'string', 'Option "keyNeighbour" has invalid format');
|
||||
assert(typeof ctx.sortFn === 'function' || ctx.sortFn === null, 'Option "sortFn" has invalid format');
|
||||
return ctx;
|
||||
};
|
||||
|
||||
module.exports = (tree, opts = {}) => {
|
||||
const ctx = buildCtx(opts);
|
||||
const result = [];
|
||||
|
||||
const sort = input => ctx.sortFn === null ? input.reverse() : input.sort((a, b) => ctx.sortFn(b, a));
|
||||
|
||||
const neighbours = [];
|
||||
const keys = sort(Object.keys(tree)).map(k => [k]);
|
||||
const lookup = [tree];
|
||||
|
||||
while (keys.length !== 0) {
|
||||
const key = keys.pop();
|
||||
const node = lookup[key.length - 1][key[key.length - 1]];
|
||||
neighbours[key.length - 1] = keys.length !== 0 && keys[keys.length - 1].length === key.length;
|
||||
result.push([neighbours.slice(0, key.length - 1).map(n => n ? ctx.spacerNeighbour : ctx.spacerNoNeighbour).join(''), neighbours[key.length - 1] ? ctx.keyNeighbour : ctx.keyNoNeighbour, key[key.length - 1], ['boolean', 'string', 'number'].includes(typeof node) ? `: ${node}` : ''].join(''));
|
||||
|
||||
if (node instanceof Object && !Array.isArray(node)) {
|
||||
keys.push(...sort(Object.keys(node)).map(k => key.concat(k)));
|
||||
lookup[key.length] = node;
|
||||
}
|
||||
}
|
||||
|
||||
return ctx.joined === true ? result.join('\n') : result;
|
||||
};
|
||||
109
node_modules/object-treeify/package.json
generated
vendored
Normal file
109
node_modules/object-treeify/package.json
generated
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
{
|
||||
"name": "object-treeify",
|
||||
"version": "1.1.33",
|
||||
"description": "Stringify Object as tree structure",
|
||||
"main": "lib/index.js",
|
||||
"scripts": {
|
||||
"clean": "rm -rf lib",
|
||||
"build": "npx babel src --out-dir lib --copy-files --include-dotfiles --config-file ./.babelrc",
|
||||
"build-clean": "yarn run clean && yarn run build",
|
||||
"test-simple": "nyc mocha \"./test/**/*.spec.js\"",
|
||||
"test": "yarn run clean && yarn run gardener && yarn run test-simple",
|
||||
"coveralls": "node ./node_modules/coveralls/bin/coveralls.js < ./coverage/lcov.info",
|
||||
"semantic-release": "yarn run build-clean && npx semantic-release",
|
||||
"gardener": "node gardener",
|
||||
"docker": "docker run --net host -u`id -u`:`id -g` -v $(pwd):/user/project -v ~/.aws:/user/.aws -v ~/.npmrc:/user/.npmrc -w /user/project -it --entrypoint /bin/bash",
|
||||
"t": "yarn test",
|
||||
"ts": "yarn run test-simple",
|
||||
"tsv": "yarn run test-simple --verbose",
|
||||
"u": "yarn upgrade --latest --force",
|
||||
"i": "yarn install --frozen-lockfile",
|
||||
"it": "yarn run i && yarn run t"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/blackflux/object-treeify.git"
|
||||
},
|
||||
"keywords": [
|
||||
"object",
|
||||
"tree",
|
||||
"print",
|
||||
"console",
|
||||
"pretty",
|
||||
"treeify",
|
||||
"stringify",
|
||||
"visualize",
|
||||
"convert",
|
||||
"string",
|
||||
"debug"
|
||||
],
|
||||
"author": "Lukas Siemon",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/blackflux/object-treeify/issues"
|
||||
},
|
||||
"homepage": "https://github.com/blackflux/object-treeify#readme",
|
||||
"devDependencies": {
|
||||
"@babel/cli": "7.13.10",
|
||||
"@babel/core": "7.13.10",
|
||||
"@babel/register": "7.13.8",
|
||||
"@blackflux/eslint-plugin-rules": "1.3.45",
|
||||
"@blackflux/robo-config-plugin": "4.1.4",
|
||||
"babel-eslint": "10.1.0",
|
||||
"babel-preset-latest-node": "5.4.0",
|
||||
"chai": "4.3.3",
|
||||
"coveralls": "3.1.0",
|
||||
"eslint": "7.21.0",
|
||||
"eslint-config-airbnb-base": "14.2.1",
|
||||
"eslint-plugin-import": "2.22.1",
|
||||
"eslint-plugin-json": "2.1.2",
|
||||
"eslint-plugin-markdown": "2.0.0",
|
||||
"eslint-plugin-mocha": "8.1.0",
|
||||
"js-gardener": "2.0.187",
|
||||
"nyc": "15.1.0",
|
||||
"semantic-release": "17.4.1"
|
||||
},
|
||||
"nyc": {
|
||||
"tempDir": "./coverage/.nyc_output",
|
||||
"report-dir": "./coverage",
|
||||
"check-coverage": true,
|
||||
"per-file": false,
|
||||
"lines": 100,
|
||||
"statements": 100,
|
||||
"functions": 100,
|
||||
"branches": 100,
|
||||
"include": [
|
||||
"**/*.js"
|
||||
],
|
||||
"reporter": [
|
||||
"lcov",
|
||||
"text-summary"
|
||||
],
|
||||
"require": [
|
||||
"@babel/register"
|
||||
],
|
||||
"extension": [],
|
||||
"cache": true,
|
||||
"all": true,
|
||||
"babel": true,
|
||||
"exclude": [
|
||||
"gardener.js",
|
||||
"node_modules/*",
|
||||
"coverage/*",
|
||||
"lib/*"
|
||||
]
|
||||
},
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "https://github.com/blackflux/object-treeify/blob/master/LICENSE"
|
||||
}
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"dependencies": {}
|
||||
}
|
||||
Reference in New Issue
Block a user