Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

wootils

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wootils - npm Package Compare versions

Comparing version 4.2.1 to 4.3.0

./@types/jimple.module.d.ts

7

CHANGELOG.md

@@ -0,1 +1,8 @@

# [4.3.0](https://github.com/homer0/wootils/compare/4.2.1...4.3.0) (2021-01-25)
### Features
* add type definitions ([9dd05d5](https://github.com/homer0/wootils/commit/9dd05d5bb747580b00b7332b71287090acbd27d2))
## [4.2.1](https://github.com/homer0/wootils/compare/4.2.0...4.2.1) (2020-12-02)

@@ -2,0 +9,0 @@

24

esm/node/appConfiguration.js

@@ -155,2 +155,8 @@ import path from 'path';

*
* @param {string | string[]} setting A setting path or a list of them.
* @param {boolean} [asArray=false] When `setting` is an Array, if this is
* `true`,
* instead of returning an object, it will
* return an array of settings.
* @returns {*}
* @example

@@ -170,8 +176,2 @@ *

*
* @param {string | string[]} setting A setting path or a list of them.
* @param {boolean} [asArray=false] When `setting` is an Array, if this is
* `true`,
* instead of returning an object, it will
* return an array of settings.
* @returns {*}
*/

@@ -297,2 +297,8 @@ get(setting, asArray = false) {

*
* @param {string | Object.<string, any>} setting The name of the setting to update or
* a dictionary of settings and their
* values.
* @param {*} [value] The value of the setting. This is
* only used when `setting` is a string.
* @throws {Error} If `setting` is not a dictionary and `value` is undefined.
* @example

@@ -308,8 +314,2 @@ *

*
* @param {string | Object.<string, any>} setting The name of the setting to update or
* a dictionary of settings and their
* values.
* @param {*} [value] The value of the setting. This is
* only used when `setting` is a string.
* @throws {Error} If `setting` is not a dictionary and `value` is undefined.
*/

@@ -316,0 +316,0 @@ set(setting, value) {

@@ -153,2 +153,7 @@ import colors from 'colors/safe.js';

*
* @param {LoggerMessage} message A text message to log or a list of them.
* @param {string} [color='raw'] Optional. The color of the message (the default
* is the terminal default). This can be
* overwritten line by line when the message is an
* array, take a look at the example.
* @example

@@ -173,7 +178,2 @@ *

*
* @param {LoggerMessage} message A text message to log or a list of them.
* @param {string} [color='raw'] Optional. The color of the message (the default
* is the terminal default). This can be
* overwritten line by line when the message is an
* array, take a look at the example.
*/

@@ -180,0 +180,0 @@ log(message, color = 'raw') {

@@ -39,5 +39,5 @@ import statuses from 'statuses';

/**
* @typedef {APIClientFetchOptions & APIClientRequestOptionsProperties}
* APIClientRequestOptions
* @typedef {APIClientFetchOptions & APIClientRequestOptionsProperties} APIClientRequestOptions
* @parent module:shared/apiClient
* @prettierignore
*/

@@ -49,3 +49,2 @@

* The request URL.
* @augments APIClientFetchOptions
* @parent module:shared/apiClient

@@ -52,0 +51,0 @@ */

@@ -25,2 +25,4 @@ /* eslint-disable jsdoc/require-jsdoc */

* @typedef {Object} Provider
* @property {ProviderRegisterFn} register The method that gets called when registering
* the provider.
* @example

@@ -30,4 +32,2 @@ *

*
* @property {ProviderRegisterFn} register The method that gets called when registering
* the provider.
* @parent module:shared/jimpleFns

@@ -51,2 +51,5 @@ */

* @callback ProviderCreator
* @param {Partial<O>} [options={}] The options to create the provider.
* @returns {Provider}
* @template O
* @example

@@ -59,7 +62,2 @@ *

*
* @param {Partial<O>} [options={}] The options to create the provider.
* @property {ProviderRegisterFn} register The method that gets called when registering
* the provider.
* @returns {Provider}
* @template O
* @parent module:shared/jimpleFns

@@ -80,3 +78,2 @@ */

* providers on the container.
* @augments ProvidersDictionary
*/

@@ -89,2 +86,5 @@

* @callback ProvidersCreator
* @param {Object.<string, Provider>} providers The dictionary of providers to add to the
* collection.
* @returns {Providers}
* @example

@@ -99,5 +99,2 @@ *

*
* @param {Object.<string, Provider>} providers The dictionary of providers to add to the
* collection.
* @returns {Providers}
*/

@@ -151,2 +148,8 @@

*
* @param {string} name The name of the resource. The generated object will have a
* property with its name and the value `true`.
* @param {string} key The name of the key that will have the function on the
* generated object.
* @param {Function} fn The function to interact with the resource.
* @returns {Resource}
* @example

@@ -162,8 +165,2 @@ *

*
* @param {string} name The name of the resource. The generated object will have a
* property with its name and the value `true`.
* @param {string} key The name of the key that will have the function on the
* generated object.
* @param {Function} fn The function to interact with the resource.
* @returns {Resource}
*/

@@ -187,2 +184,8 @@ const resource = (name, key, fn) => ({

*
* @param {string} name The name of the resource. The generated object will have a
* property with its name and the value `true`.
* @param {string} key The name of the key that will have the function on the
* generated object.
* @param {Function} creatorFn The function that will generate the 'resource function'.
* @returns {ResourceCreator}
* @example

@@ -206,8 +209,2 @@ *

*
* @param {string} name The name of the resource. The generated object will have a
* property with its name and the value `true`.
* @param {string} key The name of the key that will have the function on the
* generated object.
* @param {Function} creatorFn The function that will generate the 'resource function'.
* @returns {ResourceCreator}
*/

@@ -238,2 +235,16 @@ const resourceCreator = (name, key, creatorFn) =>

*
* @param {string} name The name of the collection. When a
* collection is generated, the returned object
* will have a property with its name and the
* value `true`.
* @param {string} key The name of the key that will have the
* function to interact with the collection on
* the final object.
* @param {?ResourcesCollectionFn} [fn=null] By default, if the `key` function of the
* collection gets called, all the items of the
* collection will be called with the same
* arguments. But you can specify a function
* that will receive all the items and all the
* arguments to customize the interaction.
* @returns {ResourcesCollectionCreator<Resource>}
* @example

@@ -272,16 +283,2 @@ *

*
* @param {string} name The name of the collection. When a
* collection is generated, the returned object
* will have a property with its name and the
* value `true`.
* @param {string} key The name of the key that will have the
* function to interact with the collection on
* the final object.
* @param {?ResourcesCollectionFn} [fn=null] By default, if the `key` function of the
* collection gets called, all the items of the
* collection will be called with the same
* arguments. But you can specify a function
* that will receive all the items and all the
* arguments to customize the interaction.
* @returns {ResourcesCollectionCreator<Resource>}
*/

@@ -322,2 +319,5 @@ const resourcesCollection = (name, key, fn = null) => (items) => {

*
* @param {ProviderRegisterFn} registerFn The function the container will call in order
* to register the provider.
* @returns {Provider}
* @example

@@ -333,5 +333,2 @@ *

*
* @param {ProviderRegisterFn} registerFn The function the container will call in order
* to register the provider.
* @returns {Provider}
*/

@@ -344,2 +341,4 @@ const provider = (registerFn) => resource('provider', 'register', registerFn);

*
* @param {ProviderCreatorFn} creatorFn The function that generates the provider.
* @returns {ProviderCreator<any>}
* @example

@@ -356,4 +355,2 @@ *

*
* @param {ProviderCreatorFn} creatorFn The function that generates the provider.
* @returns {ProviderCreator<any>}
*/

@@ -389,2 +386,4 @@ const providerCreator = (creatorFn) => resourceCreator('provider', 'register', creatorFn);

*
* @param {Jimple} container The Jimpex container the proxy will be created for.
* @returns {Jimple} The proxied version of the container.
* @example

@@ -396,4 +395,2 @@ *

*
* @param {Jimple} container The Jimpex container the proxy will be created for.
* @returns {Jimple} The proxied version of the container.
*/

@@ -400,0 +397,0 @@ const proxyContainer = (container) => {

@@ -96,13 +96,2 @@ import extend from 'extend';

*
* @example
*
* const target = {
* propOne: {
* propOneSub: 'Charito!',
* },
* propTwo: '!!!',
* };
* console.log(ObjectUtils.delete(target, 'propOne.propOneSub'));
* // Will output { propTwo: '!!!' }
*
* @param {Object} target The object from where the property will

@@ -122,2 +111,13 @@ * be removed.

* @returns {Object} A copy of the original object with the removed property/properties.
* @example
*
* const target = {
* propOne: {
* propOneSub: 'Charito!',
* },
* propTwo: '!!!',
* };
* console.log(ObjectUtils.delete(target, 'propOne.propOneSub'));
* // Will output { propTwo: '!!!' }
*
*/

@@ -156,2 +156,14 @@ static delete(

*
* @param {Object} target
* The object from where the property/properties will be extracted.
* @param {ObjectUtilsExtractPath | ObjectUtilsExtractPath[]} objPaths
* This can be a single path or a list of them. And for this method, the paths are not
* only strings but can also be an object with a single key, the would be the path to
* where to "do the extraction", and the value the path on the target object.
* @param {string} [pathDelimiter='.']
* The delimiter that will separate the path components.
* @param {boolean} [failWithError=false]
* Whether or not to throw an error when the path is invalid. If this is `false`, the
* method will silently fail an empty object.
* @returns {Object}
* @example

@@ -174,14 +186,2 @@ *

*
* @param {Object} target
* The object from where the property/properties will be extracted.
* @param {ObjectUtilsExtractPath | ObjectUtilsExtractPath[]} objPaths
* This can be a single path or a list of them. And for this method, the paths are not
* only strings but can also be an object with a single key, the would be the path to
* where to "do the extraction", and the value the path on the target object.
* @param {string} [pathDelimiter='.']
* The delimiter that will separate the path components.
* @param {boolean} [failWithError=false]
* Whether or not to throw an error when the path is invalid. If this is `false`, the
* method will silently fail an empty object.
* @returns {Object}
*/

@@ -235,13 +235,2 @@ static extract(target, objPaths, pathDelimiter = '.', failWithError = false) {

*
* @example
*
* const target = {
* propOne: {
* propOneSub: 'Charito!',
* },
* propTwo: '!!!',
* };
* console.log(ObjectUtils.flat(target);
* // Will output { 'propOne.propOneSub': 'Charito!', propTwo: '!!!' }
*
* @param {Object} target

@@ -260,2 +249,13 @@ * The object to transform.

* @returns {Object}
* @example
*
* const target = {
* propOne: {
* propOneSub: 'Charito!',
* },
* propTwo: '!!!',
* };
* console.log(ObjectUtils.flat(target);
* // Will output { 'propOne.propOneSub': 'Charito!', propTwo: '!!!' }
*
*/

@@ -286,2 +286,19 @@ static flat(target, pathDelimiter = '.', prefix = '', shouldFlattern = null) {

*
* @param {Object} target The object for format.
* @param {RegExp} searchExpression The regular expression the method will use
* "match" the keys.
* @param {Function} replaceWith The callback the method will call when
* formatting a replacement. Think of
* `searchExpression` and `replaceWith` as the
* parameters of a `.replace` call,
* where the object is the key.
* @param {string[]} [include=[]] A list of keys or paths where the
* transformation will be made. If not specified,
* the method will use all the keys from the
* object.
* @param {string[]} [exclude=[]] A list of keys or paths where the
* transformation won't be made.
* @param {string} [pathDelimiter='.'] The delimiter that will separate the path
* components for both `include` and `exclude`.
* @returns {Object}
* @example

@@ -306,19 +323,2 @@ *

*
* @param {Object} target The object for format.
* @param {RegExp} searchExpression The regular expression the method will use
* "match" the keys.
* @param {Function} replaceWith The callback the method will call when
* formatting a replacement. Think of
* `searchExpression` and `replaceWith` as the
* parameters of a `.replace` call,
* where the object is the key.
* @param {string[]} [include=[]] A list of keys or paths where the
* transformation will be made. If not specified,
* the method will use all the keys from the
* object.
* @param {string[]} [exclude=[]] A list of keys or paths where the
* transformation won't be made.
* @param {string} [pathDelimiter='.'] The delimiter that will separate the path
* components for both `include` and `exclude`.
* @returns {Object}
*/

@@ -531,2 +531,13 @@ static formatKeys(

*
* @param {Object} target The object from where the property will be
* read.
* @param {string} objPath The path to the property.
* @param {string} [pathDelimiter='.'] The delimiter that will separate the path
* components.
* @param {boolean} [failWithError=false] Whether or not to throw an error when the
* path is invalid. If this is `false`, the
* method will silently fail and return
* `undefined`.
* @returns {*}
* @throws {Error} If the path is invalid and `failWithError` is set to `true`.
* @example

@@ -543,13 +554,2 @@ *

*
* @param {Object} target The object from where the property will be
* read.
* @param {string} objPath The path to the property.
* @param {string} [pathDelimiter='.'] The delimiter that will separate the path
* components.
* @param {boolean} [failWithError=false] Whether or not to throw an error when the
* path is invalid. If this is `false`, the
* method will silently fail and return
* `undefined`.
* @returns {*}
* @throws {Error} If the path is invalid and `failWithError` is set to `true`.
*/

@@ -644,2 +644,4 @@ static get(target, objPath, pathDelimiter = '.', failWithError = false) {

*
* @param {...Object} targets The objects to merge.
* @returns {Object}
* @example

@@ -659,4 +661,2 @@ *

*
* @param {...Object} targets The objects to merge.
* @returns {Object}
*/

@@ -672,8 +672,2 @@ static merge(...targets) {

*
* @example
*
* const target = {};
* console.log(ObjectUtils.set(target, 'some.prop.path', 'some-value'));
* // Will output { some: { prop: { path: 'some-value' } } }
*
* @param {Object} target The object where the property will be set.

@@ -691,2 +685,8 @@ * @param {string} objPath The path for the property.

* `failWithError` is set to `true`.
* @example
*
* const target = {};
* console.log(ObjectUtils.set(target, 'some.prop.path', 'some-value'));
* // Will output { some: { prop: { path: 'some-value' } } }
*
*/

@@ -787,2 +787,6 @@ static set(target, objPath, value, pathDelimiter = '.', failWithError = false) {

*
* @param {Object} target The object to transform.
* @param {string} [pathDelimiter='.'] The delimiter that will separate the path
* components.
* @returns {Object}
* @example

@@ -797,6 +801,2 @@ *

*
* @param {Object} target The object to transform.
* @param {string} [pathDelimiter='.'] The delimiter that will separate the path
* components.
* @returns {Object}
*/

@@ -803,0 +803,0 @@ static unflat(target, pathDelimiter = '.') {

@@ -155,2 +155,8 @@ const path = require('path');

*
* @param {string | string[]} setting A setting path or a list of them.
* @param {boolean} [asArray=false] When `setting` is an Array, if this is
* `true`,
* instead of returning an object, it will
* return an array of settings.
* @returns {*}
* @example

@@ -170,8 +176,2 @@ *

*
* @param {string | string[]} setting A setting path or a list of them.
* @param {boolean} [asArray=false] When `setting` is an Array, if this is
* `true`,
* instead of returning an object, it will
* return an array of settings.
* @returns {*}
*/

@@ -297,2 +297,8 @@ get(setting, asArray = false) {

*
* @param {string | Object.<string, any>} setting The name of the setting to update or
* a dictionary of settings and their
* values.
* @param {*} [value] The value of the setting. This is
* only used when `setting` is a string.
* @throws {Error} If `setting` is not a dictionary and `value` is undefined.
* @example

@@ -308,8 +314,2 @@ *

*
* @param {string | Object.<string, any>} setting The name of the setting to update or
* a dictionary of settings and their
* values.
* @param {*} [value] The value of the setting. This is
* only used when `setting` is a string.
* @throws {Error} If `setting` is not a dictionary and `value` is undefined.
*/

@@ -316,0 +316,0 @@ set(setting, value) {

@@ -153,2 +153,7 @@ const colors = require('colors/safe');

*
* @param {LoggerMessage} message A text message to log or a list of them.
* @param {string} [color='raw'] Optional. The color of the message (the default
* is the terminal default). This can be
* overwritten line by line when the message is an
* array, take a look at the example.
* @example

@@ -173,7 +178,2 @@ *

*
* @param {LoggerMessage} message A text message to log or a list of them.
* @param {string} [color='raw'] Optional. The color of the message (the default
* is the terminal default). This can be
* overwritten line by line when the message is an
* array, take a look at the example.
*/

@@ -180,0 +180,0 @@ log(message, color = 'raw') {

@@ -5,3 +5,3 @@ {

"homepage": "https://homer0.github.io/wootils/",
"version": "4.2.1",
"version": "4.3.0",
"repository": "homer0/wootils",

@@ -11,19 +11,19 @@ "author": "Leonardo Apiwan (@homer0) <me@homer0.com>",

"dependencies": {
"fs-extra": "^9.0.1",
"fs-extra": "^9.1.0",
"colors": "^1.4.0",
"urijs": "^1.19.2",
"statuses": "^2.0.0",
"urijs": "^1.19.5",
"statuses": "^2.0.1",
"extend": "^3.0.2"
},
"devDependencies": {
"@homer0/eslint-plugin": "^6.0.1",
"@homer0/eslint-plugin": "^6.0.2",
"@homer0/prettier-config": "^1.1.1",
"@homer0/prettier-plugin-jsdoc": "^1.1.2",
"@homer0/prettier-plugin-jsdoc": "^2.0.0",
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/git": "^9.0.0",
"cjs2esm": "^1.1.0",
"commitizen": "^4.2.2",
"commitizen": "^4.2.3",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^7.14.0",
"husky": "^4.3.0",
"eslint": "^7.18.0",
"husky": "^4.3.8",
"jest": "^26.6.3",

@@ -34,6 +34,8 @@ "jimple": "^1.5.0",

"docdash": "homer0/docdash#semver:^2.1.0",
"leasot": "^11.4.0",
"lint-staged": "^10.5.2",
"leasot": "^11.5.0",
"lint-staged": "^10.5.3",
"prettier": "^2.2.1",
"semantic-release": "^17.3.0"
"semantic-release": "^17.3.7",
"typescript": "^4.1.3",
"yarn-or-npm": "^3.0.1"
},

@@ -63,3 +65,6 @@ "engine-strict": true,

"docs": "./utils/scripts/docs",
"todo": "./utils/scripts/todo"
"todo": "./utils/scripts/todo",
"types": "./utils/scripts/types",
"pretypes:move": "yon run types",
"types:move": "node ./utils/scripts/types-move.js"
},

@@ -66,0 +71,0 @@ "config": {

@@ -39,5 +39,5 @@ const statuses = require('statuses');

/**
* @typedef {APIClientFetchOptions & APIClientRequestOptionsProperties}
* APIClientRequestOptions
* @typedef {APIClientFetchOptions & APIClientRequestOptionsProperties} APIClientRequestOptions
* @parent module:shared/apiClient
* @prettierignore
*/

@@ -49,3 +49,2 @@

* The request URL.
* @augments APIClientFetchOptions
* @parent module:shared/apiClient

@@ -52,0 +51,0 @@ */

@@ -25,2 +25,4 @@ /* eslint-disable jsdoc/require-jsdoc */

* @typedef {Object} Provider
* @property {ProviderRegisterFn} register The method that gets called when registering
* the provider.
* @example

@@ -30,4 +32,2 @@ *

*
* @property {ProviderRegisterFn} register The method that gets called when registering
* the provider.
* @parent module:shared/jimpleFns

@@ -51,2 +51,5 @@ */

* @callback ProviderCreator
* @param {Partial<O>} [options={}] The options to create the provider.
* @returns {Provider}
* @template O
* @example

@@ -59,7 +62,2 @@ *

*
* @param {Partial<O>} [options={}] The options to create the provider.
* @property {ProviderRegisterFn} register The method that gets called when registering
* the provider.
* @returns {Provider}
* @template O
* @parent module:shared/jimpleFns

@@ -80,3 +78,2 @@ */

* providers on the container.
* @augments ProvidersDictionary
*/

@@ -89,2 +86,5 @@

* @callback ProvidersCreator
* @param {Object.<string, Provider>} providers The dictionary of providers to add to the
* collection.
* @returns {Providers}
* @example

@@ -99,5 +99,2 @@ *

*
* @param {Object.<string, Provider>} providers The dictionary of providers to add to the
* collection.
* @returns {Providers}
*/

@@ -151,2 +148,8 @@

*
* @param {string} name The name of the resource. The generated object will have a
* property with its name and the value `true`.
* @param {string} key The name of the key that will have the function on the
* generated object.
* @param {Function} fn The function to interact with the resource.
* @returns {Resource}
* @example

@@ -162,8 +165,2 @@ *

*
* @param {string} name The name of the resource. The generated object will have a
* property with its name and the value `true`.
* @param {string} key The name of the key that will have the function on the
* generated object.
* @param {Function} fn The function to interact with the resource.
* @returns {Resource}
*/

@@ -187,2 +184,8 @@ const resource = (name, key, fn) => ({

*
* @param {string} name The name of the resource. The generated object will have a
* property with its name and the value `true`.
* @param {string} key The name of the key that will have the function on the
* generated object.
* @param {Function} creatorFn The function that will generate the 'resource function'.
* @returns {ResourceCreator}
* @example

@@ -206,8 +209,2 @@ *

*
* @param {string} name The name of the resource. The generated object will have a
* property with its name and the value `true`.
* @param {string} key The name of the key that will have the function on the
* generated object.
* @param {Function} creatorFn The function that will generate the 'resource function'.
* @returns {ResourceCreator}
*/

@@ -238,2 +235,16 @@ const resourceCreator = (name, key, creatorFn) =>

*
* @param {string} name The name of the collection. When a
* collection is generated, the returned object
* will have a property with its name and the
* value `true`.
* @param {string} key The name of the key that will have the
* function to interact with the collection on
* the final object.
* @param {?ResourcesCollectionFn} [fn=null] By default, if the `key` function of the
* collection gets called, all the items of the
* collection will be called with the same
* arguments. But you can specify a function
* that will receive all the items and all the
* arguments to customize the interaction.
* @returns {ResourcesCollectionCreator<Resource>}
* @example

@@ -272,16 +283,2 @@ *

*
* @param {string} name The name of the collection. When a
* collection is generated, the returned object
* will have a property with its name and the
* value `true`.
* @param {string} key The name of the key that will have the
* function to interact with the collection on
* the final object.
* @param {?ResourcesCollectionFn} [fn=null] By default, if the `key` function of the
* collection gets called, all the items of the
* collection will be called with the same
* arguments. But you can specify a function
* that will receive all the items and all the
* arguments to customize the interaction.
* @returns {ResourcesCollectionCreator<Resource>}
*/

@@ -322,2 +319,5 @@ const resourcesCollection = (name, key, fn = null) => (items) => {

*
* @param {ProviderRegisterFn} registerFn The function the container will call in order
* to register the provider.
* @returns {Provider}
* @example

@@ -333,5 +333,2 @@ *

*
* @param {ProviderRegisterFn} registerFn The function the container will call in order
* to register the provider.
* @returns {Provider}
*/

@@ -344,2 +341,4 @@ const provider = (registerFn) => resource('provider', 'register', registerFn);

*
* @param {ProviderCreatorFn} creatorFn The function that generates the provider.
* @returns {ProviderCreator<any>}
* @example

@@ -356,4 +355,2 @@ *

*
* @param {ProviderCreatorFn} creatorFn The function that generates the provider.
* @returns {ProviderCreator<any>}
*/

@@ -389,2 +386,4 @@ const providerCreator = (creatorFn) => resourceCreator('provider', 'register', creatorFn);

*
* @param {Jimple} container The Jimpex container the proxy will be created for.
* @returns {Jimple} The proxied version of the container.
* @example

@@ -396,4 +395,2 @@ *

*
* @param {Jimple} container The Jimpex container the proxy will be created for.
* @returns {Jimple} The proxied version of the container.
*/

@@ -400,0 +397,0 @@ const proxyContainer = (container) => {

@@ -96,13 +96,2 @@ const extend = require('extend');

*
* @example
*
* const target = {
* propOne: {
* propOneSub: 'Charito!',
* },
* propTwo: '!!!',
* };
* console.log(ObjectUtils.delete(target, 'propOne.propOneSub'));
* // Will output { propTwo: '!!!' }
*
* @param {Object} target The object from where the property will

@@ -122,2 +111,13 @@ * be removed.

* @returns {Object} A copy of the original object with the removed property/properties.
* @example
*
* const target = {
* propOne: {
* propOneSub: 'Charito!',
* },
* propTwo: '!!!',
* };
* console.log(ObjectUtils.delete(target, 'propOne.propOneSub'));
* // Will output { propTwo: '!!!' }
*
*/

@@ -156,2 +156,14 @@ static delete(

*
* @param {Object} target
* The object from where the property/properties will be extracted.
* @param {ObjectUtilsExtractPath | ObjectUtilsExtractPath[]} objPaths
* This can be a single path or a list of them. And for this method, the paths are not
* only strings but can also be an object with a single key, the would be the path to
* where to "do the extraction", and the value the path on the target object.
* @param {string} [pathDelimiter='.']
* The delimiter that will separate the path components.
* @param {boolean} [failWithError=false]
* Whether or not to throw an error when the path is invalid. If this is `false`, the
* method will silently fail an empty object.
* @returns {Object}
* @example

@@ -174,14 +186,2 @@ *

*
* @param {Object} target
* The object from where the property/properties will be extracted.
* @param {ObjectUtilsExtractPath | ObjectUtilsExtractPath[]} objPaths
* This can be a single path or a list of them. And for this method, the paths are not
* only strings but can also be an object with a single key, the would be the path to
* where to "do the extraction", and the value the path on the target object.
* @param {string} [pathDelimiter='.']
* The delimiter that will separate the path components.
* @param {boolean} [failWithError=false]
* Whether or not to throw an error when the path is invalid. If this is `false`, the
* method will silently fail an empty object.
* @returns {Object}
*/

@@ -235,13 +235,2 @@ static extract(target, objPaths, pathDelimiter = '.', failWithError = false) {

*
* @example
*
* const target = {
* propOne: {
* propOneSub: 'Charito!',
* },
* propTwo: '!!!',
* };
* console.log(ObjectUtils.flat(target);
* // Will output { 'propOne.propOneSub': 'Charito!', propTwo: '!!!' }
*
* @param {Object} target

@@ -260,2 +249,13 @@ * The object to transform.

* @returns {Object}
* @example
*
* const target = {
* propOne: {
* propOneSub: 'Charito!',
* },
* propTwo: '!!!',
* };
* console.log(ObjectUtils.flat(target);
* // Will output { 'propOne.propOneSub': 'Charito!', propTwo: '!!!' }
*
*/

@@ -286,2 +286,19 @@ static flat(target, pathDelimiter = '.', prefix = '', shouldFlattern = null) {

*
* @param {Object} target The object for format.
* @param {RegExp} searchExpression The regular expression the method will use
* "match" the keys.
* @param {Function} replaceWith The callback the method will call when
* formatting a replacement. Think of
* `searchExpression` and `replaceWith` as the
* parameters of a `.replace` call,
* where the object is the key.
* @param {string[]} [include=[]] A list of keys or paths where the
* transformation will be made. If not specified,
* the method will use all the keys from the
* object.
* @param {string[]} [exclude=[]] A list of keys or paths where the
* transformation won't be made.
* @param {string} [pathDelimiter='.'] The delimiter that will separate the path
* components for both `include` and `exclude`.
* @returns {Object}
* @example

@@ -306,19 +323,2 @@ *

*
* @param {Object} target The object for format.
* @param {RegExp} searchExpression The regular expression the method will use
* "match" the keys.
* @param {Function} replaceWith The callback the method will call when
* formatting a replacement. Think of
* `searchExpression` and `replaceWith` as the
* parameters of a `.replace` call,
* where the object is the key.
* @param {string[]} [include=[]] A list of keys or paths where the
* transformation will be made. If not specified,
* the method will use all the keys from the
* object.
* @param {string[]} [exclude=[]] A list of keys or paths where the
* transformation won't be made.
* @param {string} [pathDelimiter='.'] The delimiter that will separate the path
* components for both `include` and `exclude`.
* @returns {Object}
*/

@@ -531,2 +531,13 @@ static formatKeys(

*
* @param {Object} target The object from where the property will be
* read.
* @param {string} objPath The path to the property.
* @param {string} [pathDelimiter='.'] The delimiter that will separate the path
* components.
* @param {boolean} [failWithError=false] Whether or not to throw an error when the
* path is invalid. If this is `false`, the
* method will silently fail and return
* `undefined`.
* @returns {*}
* @throws {Error} If the path is invalid and `failWithError` is set to `true`.
* @example

@@ -543,13 +554,2 @@ *

*
* @param {Object} target The object from where the property will be
* read.
* @param {string} objPath The path to the property.
* @param {string} [pathDelimiter='.'] The delimiter that will separate the path
* components.
* @param {boolean} [failWithError=false] Whether or not to throw an error when the
* path is invalid. If this is `false`, the
* method will silently fail and return
* `undefined`.
* @returns {*}
* @throws {Error} If the path is invalid and `failWithError` is set to `true`.
*/

@@ -644,2 +644,4 @@ static get(target, objPath, pathDelimiter = '.', failWithError = false) {

*
* @param {...Object} targets The objects to merge.
* @returns {Object}
* @example

@@ -659,4 +661,2 @@ *

*
* @param {...Object} targets The objects to merge.
* @returns {Object}
*/

@@ -672,8 +672,2 @@ static merge(...targets) {

*
* @example
*
* const target = {};
* console.log(ObjectUtils.set(target, 'some.prop.path', 'some-value'));
* // Will output { some: { prop: { path: 'some-value' } } }
*
* @param {Object} target The object where the property will be set.

@@ -691,2 +685,8 @@ * @param {string} objPath The path for the property.

* `failWithError` is set to `true`.
* @example
*
* const target = {};
* console.log(ObjectUtils.set(target, 'some.prop.path', 'some-value'));
* // Will output { some: { prop: { path: 'some-value' } } }
*
*/

@@ -787,2 +787,6 @@ static set(target, objPath, value, pathDelimiter = '.', failWithError = false) {

*
* @param {Object} target The object to transform.
* @param {string} [pathDelimiter='.'] The delimiter that will separate the path
* components.
* @returns {Object}
* @example

@@ -797,6 +801,2 @@ *

*
* @param {Object} target The object to transform.
* @param {string} [pathDelimiter='.'] The delimiter that will separate the path
* components.
* @returns {Object}
*/

@@ -803,0 +803,0 @@ static unflat(target, pathDelimiter = '.') {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc