lodash-omitdeep
Advanced tools
Comparing version 1.0.12 to 1.0.14
@@ -0,0 +0,0 @@ import omitDeep from './omitDeep/omitDeep'; |
@@ -5,4 +5,4 @@ "use strict"; | ||
}; | ||
var omitDeep_1 = __importDefault(require("./omitDeep/omitDeep")); | ||
var omitDeepBy_1 = __importDefault(require("./omitDeepBy/omitDeepBy")); | ||
const omitDeep_1 = __importDefault(require("./omitDeep/omitDeep")); | ||
const omitDeepBy_1 = __importDefault(require("./omitDeepBy/omitDeepBy")); | ||
module.exports = { omitDeep: omitDeep_1.default, omitByDeep: omitDeepBy_1.default }; |
@@ -1,2 +0,2 @@ | ||
import { Many, PropertyName, PartialObject } from 'lodash'; | ||
import type { Many, PropertyName, PartialObject } from 'lodash'; | ||
/** | ||
@@ -6,3 +6,3 @@ * The opposite of `_.pick`; this method creates an object composed of the | ||
* | ||
* @category Object | ||
* @category Function | ||
* @param object The source object. | ||
@@ -14,3 +14,3 @@ * @param [paths] The property names to omit, specified | ||
* | ||
* var object = { 'a': 1, 'b': 2, 'c': { 'a': 1, 'b': 2 } }; | ||
* const object = { 'a': 1, 'b': 2, 'c': { 'a': 1, 'b': 2 } }; | ||
* | ||
@@ -17,0 +17,0 @@ * omitDeep(object, ['b', 'a']); |
"use strict"; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -15,10 +6,6 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var lodash_omit_1 = __importDefault(require("lodash.omit")); | ||
var lodash_isplainobject_1 = __importDefault(require("lodash.isplainobject")); | ||
var lodash_isnil_1 = __importDefault(require("lodash.isnil")); | ||
function omitDeep(object) { | ||
var paths = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
paths[_i - 1] = arguments[_i]; | ||
} | ||
const lodash_omit_1 = __importDefault(require("lodash.omit")); | ||
const lodash_isplainobject_1 = __importDefault(require("lodash.isplainobject")); | ||
const lodash_isnil_1 = __importDefault(require("lodash.isnil")); | ||
function omitDeep(object, ...paths) { | ||
function omitDeepOnOwnProps(object) { | ||
@@ -29,10 +16,9 @@ if (!Array.isArray(object) && !(0, lodash_isplainobject_1.default)(object)) { | ||
if (Array.isArray(object)) { | ||
return object.map(function (element) { return (needOmit(element) ? omitDeep.apply(void 0, __spreadArray([element], paths, false)) : element); }); | ||
return object.map((element) => (needOmit(element) ? omitDeep(element, ...paths) : element)); | ||
} | ||
var temp = {}; | ||
for (var _i = 0, _a = Object.entries(object); _i < _a.length; _i++) { | ||
var _b = _a[_i], key = _b[0], value = _b[1]; | ||
temp[key] = needOmit(value) ? omitDeep.apply(void 0, __spreadArray([value], paths, false)) : value; | ||
const temp = {}; | ||
for (const [key, value] of Object.entries(object)) { | ||
temp[key] = needOmit(value) ? omitDeep(value, ...paths) : value; | ||
} | ||
return lodash_omit_1.default.apply(void 0, __spreadArray([temp], paths, false)); | ||
return (0, lodash_omit_1.default)(temp, ...paths); | ||
} | ||
@@ -39,0 +25,0 @@ return omitDeepOnOwnProps(object); |
@@ -1,2 +0,2 @@ | ||
import { PartialObject, ValueKeyIteratee, NumericDictionary, Dictionary } from 'lodash'; | ||
import type { PartialObject, ValueKeyIteratee, NumericDictionary, Dictionary } from 'lodash'; | ||
/** | ||
@@ -7,3 +7,3 @@ * The opposite of `_.pickBy`; this method creates an object composed of the | ||
* | ||
* @category Object | ||
* @category Function | ||
* @param object The source object. | ||
@@ -14,3 +14,3 @@ * @param [predicate=_.identity] The function invoked per property. | ||
* | ||
* var object = { 'a': 1, 'b': null, 'c': { 'a': 1, 'b': null } }; | ||
* const object = { 'a': 1, 'b': null, 'c': { 'a': 1, 'b': null } }; | ||
* | ||
@@ -17,0 +17,0 @@ * omitByDeep(object, _.isNil); |
@@ -6,4 +6,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var lodash_omitby_1 = __importDefault(require("lodash.omitby")); | ||
var lodash_isplainobject_1 = __importDefault(require("lodash.isplainobject")); | ||
const lodash_omitby_1 = __importDefault(require("lodash.omitby")); | ||
const lodash_isplainobject_1 = __importDefault(require("lodash.isplainobject")); | ||
function omitByDeep(object, cb) { | ||
@@ -15,7 +15,6 @@ function omitByDeepByOnOwnProps(object) { | ||
if (Array.isArray(object)) { | ||
return object.map(function (element) { return omitByDeep(element, cb); }); | ||
return object.map((element) => omitByDeep(element, cb)); | ||
} | ||
var temp = {}; | ||
for (var _i = 0, _a = Object.entries(object); _i < _a.length; _i++) { | ||
var _b = _a[_i], key = _b[0], value = _b[1]; | ||
const temp = {}; | ||
for (const [key, value] of Object.entries(object)) { | ||
temp[key] = omitByDeep(value, cb); | ||
@@ -22,0 +21,0 @@ } |
{ | ||
"name": "lodash-omitdeep", | ||
"version": "1.0.12", | ||
"version": "1.0.14", | ||
"description": "Lodash omitDeep/omitByDeep object key/value recursively", | ||
@@ -33,3 +33,3 @@ "main": "lib/index.js", | ||
"scripts": { | ||
"build": "tsc --project tsconfig.prod.json", | ||
"build": "tsc --project tsconfig.json", | ||
"prepublishOnly": "npm test && npm run lint", | ||
@@ -46,3 +46,3 @@ "preversion": "npm run lint", | ||
"devDependencies": { | ||
"@types/jest": "^29.0.0", | ||
"@types/jest": "^29.2.3", | ||
"@types/lodash.isnil": "^4.0.7", | ||
@@ -52,8 +52,8 @@ "@types/lodash.isplainobject": "^4.0.7", | ||
"@types/lodash.omitby": "^4.6.7", | ||
"jest": "^29.0.2", | ||
"jest": "^29.2.3", | ||
"prettier": "^2.7.1", | ||
"ts-jest": "^29.0.0", | ||
"ts-jest": "^29.0.3", | ||
"tslint": "^6.1.3", | ||
"tslint-config-prettier": "^1.18.0", | ||
"typescript": "^4.8.3" | ||
"typescript": "^4.9.3" | ||
}, | ||
@@ -60,0 +60,0 @@ "dependencies": { |
7768
108