diff options
author | Minteck <contact@minteck.org> | 2022-06-04 08:51:19 +0200 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-06-04 08:51:19 +0200 |
commit | b22f6770c8bd084d66950655203c61dd701b3d90 (patch) | |
tree | 873d7fb19584ec2709b95cc1ca05a1fc7cfd0fc4 /node_modules/dot-prop | |
parent | 383285ecd5292bf9a825e05904955b937de84cc9 (diff) | |
download | equestriadb-b22f6770c8bd084d66950655203c61dd701b3d90.tar.gz equestriadb-b22f6770c8bd084d66950655203c61dd701b3d90.tar.bz2 equestriadb-b22f6770c8bd084d66950655203c61dd701b3d90.zip |
Remove node_modules
Diffstat (limited to 'node_modules/dot-prop')
-rw-r--r-- | node_modules/dot-prop/index.d.ts | 101 | ||||
-rw-r--r-- | node_modules/dot-prop/index.js | 142 | ||||
-rw-r--r-- | node_modules/dot-prop/license | 9 | ||||
-rw-r--r-- | node_modules/dot-prop/package.json | 45 | ||||
-rw-r--r-- | node_modules/dot-prop/readme.md | 117 |
5 files changed, 0 insertions, 414 deletions
diff --git a/node_modules/dot-prop/index.d.ts b/node_modules/dot-prop/index.d.ts deleted file mode 100644 index 861f533..0000000 --- a/node_modules/dot-prop/index.d.ts +++ /dev/null @@ -1,101 +0,0 @@ -declare const dotProp: { - /** - @param object - Object to get the `path` value. - @param path - Path of the property in the object, using `.` to separate each nested key. Use `\\.` if you have a `.` in the key. - @param defaultValue - Default value. - - @example - ``` - import dotProp = require('dot-prop'); - - dotProp.get({foo: {bar: 'unicorn'}}, 'foo.bar'); - //=> 'unicorn' - - dotProp.get({foo: {bar: 'a'}}, 'foo.notDefined.deep'); - //=> undefined - - dotProp.get({foo: {bar: 'a'}}, 'foo.notDefined.deep', 'default value'); - //=> 'default value' - - dotProp.get({foo: {'dot.dot': 'unicorn'}}, 'foo.dot\\.dot'); - //=> 'unicorn' - ``` - */ - get<T>( - object: {[key: string]: any} | undefined, - path: string - ): T | undefined; - get<T>( - object: {[key: string]: any} | undefined, - path: string, - defaultValue: T - ): T; - - /** - @param object - Object to set the `path` value. - @param path - Path of the property in the object, using `.` to separate each nested key. Use `\\.` if you have a `.` in the key. - @param value - Value to set at `path`. - @returns The object. - - @example - ``` - import dotProp = require('dot-prop'); - - const object = {foo: {bar: 'a'}}; - dotProp.set(object, 'foo.bar', 'b'); - console.log(object); - //=> {foo: {bar: 'b'}} - - const foo = dotProp.set({}, 'foo.bar', 'c'); - console.log(foo); - //=> {foo: {bar: 'c'}} - - dotProp.set(object, 'foo.baz', 'x'); - console.log(object); - //=> {foo: {bar: 'b', baz: 'x'}} - ``` - */ - set<T extends {[key: string]: any}>( - object: T, - path: string, - value: unknown - ): T; - - /** - @param object - Object to test the `path` value. - @param path - Path of the property in the object, using `.` to separate each nested key. Use `\\.` if you have a `.` in the key. - - @example - ``` - import dotProp = require('dot-prop'); - - dotProp.has({foo: {bar: 'unicorn'}}, 'foo.bar'); - //=> true - ``` - */ - has(object: {[key: string]: any} | undefined, path: string): boolean; - - /** - @param object - Object to delete the `path` value. - @param path - Path of the property in the object, using `.` to separate each nested key. Use `\\.` if you have a `.` in the key. - @returns A boolean of whether the property existed before being deleted. - - @example - ``` - import dotProp = require('dot-prop'); - - const object = {foo: {bar: 'a'}}; - dotProp.delete(object, 'foo.bar'); - console.log(object); - //=> {foo: {}} - - object.foo.bar = {x: 'y', y: 'x'}; - dotProp.delete(object, 'foo.bar.x'); - console.log(object); - //=> {foo: {bar: {y: 'x'}}} - ``` - */ - delete(object: {[key: string]: any}, path: string): boolean; -}; - -export = dotProp; diff --git a/node_modules/dot-prop/index.js b/node_modules/dot-prop/index.js deleted file mode 100644 index a90f599..0000000 --- a/node_modules/dot-prop/index.js +++ /dev/null @@ -1,142 +0,0 @@ -'use strict'; -const isObj = require('is-obj'); - -const disallowedKeys = [ - '__proto__', - 'prototype', - 'constructor' -]; - -const isValidPath = pathSegments => !pathSegments.some(segment => disallowedKeys.includes(segment)); - -function getPathSegments(path) { - const pathArray = path.split('.'); - const parts = []; - - for (let i = 0; i < pathArray.length; i++) { - let p = pathArray[i]; - - while (p[p.length - 1] === '\\' && pathArray[i + 1] !== undefined) { - p = p.slice(0, -1) + '.'; - p += pathArray[++i]; - } - - parts.push(p); - } - - if (!isValidPath(parts)) { - return []; - } - - return parts; -} - -module.exports = { - get(object, path, value) { - if (!isObj(object) || typeof path !== 'string') { - return value === undefined ? object : value; - } - - const pathArray = getPathSegments(path); - if (pathArray.length === 0) { - return; - } - - for (let i = 0; i < pathArray.length; i++) { - if (!Object.prototype.propertyIsEnumerable.call(object, pathArray[i])) { - return value; - } - - object = object[pathArray[i]]; - - if (object === undefined || object === null) { - // `object` is either `undefined` or `null` so we want to stop the loop, and - // if this is not the last bit of the path, and - // if it did't return `undefined` - // it would return `null` if `object` is `null` - // but we want `get({foo: null}, 'foo.bar')` to equal `undefined`, or the supplied value, not `null` - if (i !== pathArray.length - 1) { - return value; - } - - break; - } - } - - return object; - }, - - set(object, path, value) { - if (!isObj(object) || typeof path !== 'string') { - return object; - } - - const root = object; - const pathArray = getPathSegments(path); - - for (let i = 0; i < pathArray.length; i++) { - const p = pathArray[i]; - - if (!isObj(object[p])) { - object[p] = {}; - } - - if (i === pathArray.length - 1) { - object[p] = value; - } - - object = object[p]; - } - - return root; - }, - - delete(object, path) { - if (!isObj(object) || typeof path !== 'string') { - return false; - } - - const pathArray = getPathSegments(path); - - for (let i = 0; i < pathArray.length; i++) { - const p = pathArray[i]; - - if (i === pathArray.length - 1) { - delete object[p]; - return true; - } - - object = object[p]; - - if (!isObj(object)) { - return false; - } - } - }, - - has(object, path) { - if (!isObj(object) || typeof path !== 'string') { - return false; - } - - const pathArray = getPathSegments(path); - if (pathArray.length === 0) { - return false; - } - - // eslint-disable-next-line unicorn/no-for-loop - for (let i = 0; i < pathArray.length; i++) { - if (isObj(object)) { - if (!(pathArray[i] in object)) { - return false; - } - - object = object[pathArray[i]]; - } else { - return false; - } - } - - return true; - } -}; diff --git a/node_modules/dot-prop/license b/node_modules/dot-prop/license deleted file mode 100644 index e7af2f7..0000000 --- a/node_modules/dot-prop/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.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/dot-prop/package.json b/node_modules/dot-prop/package.json deleted file mode 100644 index d4e51bf..0000000 --- a/node_modules/dot-prop/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "dot-prop", - "version": "5.3.0", - "description": "Get, set, or delete a property from a nested object using a dot path", - "license": "MIT", - "repository": "sindresorhus/dot-prop", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava && tsd", - "bench": "node bench.js" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "object", - "prop", - "property", - "dot", - "path", - "get", - "set", - "delete", - "access", - "notation", - "dotty" - ], - "dependencies": { - "is-obj": "^2.0.0" - }, - "devDependencies": { - "ava": "^2.1.0", - "benchmark": "^2.1.4", - "tsd": "^0.7.2", - "xo": "^0.25.3" - } -} diff --git a/node_modules/dot-prop/readme.md b/node_modules/dot-prop/readme.md deleted file mode 100644 index 4170565..0000000 --- a/node_modules/dot-prop/readme.md +++ /dev/null @@ -1,117 +0,0 @@ -# dot-prop [![Build Status](https://travis-ci.org/sindresorhus/dot-prop.svg?branch=master)](https://travis-ci.org/sindresorhus/dot-prop) - -> Get, set, or delete a property from a nested object using a dot path - - -## Install - -``` -$ npm install dot-prop -``` - - -## Usage - -```js -const dotProp = require('dot-prop'); - -// Getter -dotProp.get({foo: {bar: 'unicorn'}}, 'foo.bar'); -//=> 'unicorn' - -dotProp.get({foo: {bar: 'a'}}, 'foo.notDefined.deep'); -//=> undefined - -dotProp.get({foo: {bar: 'a'}}, 'foo.notDefined.deep', 'default value'); -//=> 'default value' - -dotProp.get({foo: {'dot.dot': 'unicorn'}}, 'foo.dot\\.dot'); -//=> 'unicorn' - -// Setter -const object = {foo: {bar: 'a'}}; -dotProp.set(object, 'foo.bar', 'b'); -console.log(object); -//=> {foo: {bar: 'b'}} - -const foo = dotProp.set({}, 'foo.bar', 'c'); -console.log(foo); -//=> {foo: {bar: 'c'}} - -dotProp.set(object, 'foo.baz', 'x'); -console.log(object); -//=> {foo: {bar: 'b', baz: 'x'}} - -// Has -dotProp.has({foo: {bar: 'unicorn'}}, 'foo.bar'); -//=> true - -// Deleter -const object = {foo: {bar: 'a'}}; -dotProp.delete(object, 'foo.bar'); -console.log(object); -//=> {foo: {}} - -object.foo.bar = {x: 'y', y: 'x'}; -dotProp.delete(object, 'foo.bar.x'); -console.log(object); -//=> {foo: {bar: {y: 'x'}}} -``` - - -## API - -### get(object, path, defaultValue?) - -### set(object, path, value) - -Returns the object. - -### has(object, path) - -### delete(object, path) - -Returns a boolean of whether the property existed before being deleted. - -#### object - -Type: `object` - -Object to get, set, or delete the `path` value. - -You are allowed to pass in `undefined` as the object to the `get` and `has` functions. - -#### path - -Type: `string` - -Path of the property in the object, using `.` to separate each nested key. - -Use `\\.` if you have a `.` in the key. - -The following path components are invalid and results in `undefined` being returned: `__proto__`, `prototype`, `constructor`. - -#### value - -Type: `unknown` - -Value to set at `path`. - -#### defaultValue - -Type: `unknown` - -Default value. - - ---- - -<div align="center"> - <b> - <a href="https://tidelift.com/subscription/pkg/npm-dot-prop?utm_source=npm-dot-prop&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a> - </b> - <br> - <sub> - Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies. - </sub> -</div> |