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

@gedit/utils

Package Overview
Dependencies
Maintainers
3
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gedit/utils - npm Package Compare versions

Comparing version 0.1.59 to 0.1.60

lib/common/id.d.ts

1

lib/common/index.d.ts
import debounce = require('lodash.debounce');
export * from './id';
export * from './array';

@@ -3,0 +4,0 @@ export * from './objects';

@@ -16,2 +16,3 @@ "use strict";

exports.debounce = debounce;
__exportStar(require("./id"), exports);
__exportStar(require("./array"), exports);

@@ -18,0 +19,0 @@ __exportStar(require("./objects"), exports);

2

lib/common/objects.d.ts

@@ -45,4 +45,4 @@ export declare const deepClone: any;

*/
export declare function setByKey(target: any, key: string, newValue: any, autoCreateObject?: boolean): boolean;
export declare function setByKey(target: any, key: string, newValue: any, autoCreateObject?: boolean, clone?: boolean): any;
export declare const NOOP: () => void;
//# sourceMappingURL=objects.d.ts.map
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -136,6 +147,10 @@ exports.NOOP = exports.setByKey = exports.getByKey = exports.mapKeys = exports.mapValues = exports.reduce = exports.omit = exports.pick = exports.filter = exports.values = exports.each = exports.isEmpty = exports.notEmpty = exports.deepFreeze = exports.deepClone = void 0;

*/
function setByKey(target, key, newValue, autoCreateObject) {
function setByKey(target, key, newValue, autoCreateObject, clone) {
if (autoCreateObject === void 0) { autoCreateObject = true; }
if (typeof target !== 'object' || !key)
return false;
return target;
if (clone) {
target = __assign({}, target);
}
var originTarget = target;
var targetKeys = key.split('.');

@@ -146,12 +161,15 @@ while (targetKeys.length > 0) {

target[key] = newValue;
return true;
return originTarget;
}
if (typeof target[key] !== 'object') {
if (!autoCreateObject)
return false;
return originTarget;
target[key] = {};
}
if (clone) {
target[key] = __assign({}, target[key]);
}
target = target[key];
}
return false;
return originTarget;
}

@@ -158,0 +176,0 @@ exports.setByKey = setByKey;

{
"name": "@gedit/utils",
"version": "0.1.59",
"version": "0.1.60",
"license": "MIT",

@@ -31,3 +31,3 @@ "main": "lib/common/index",

},
"gitHead": "1ec58b0dd56849d324e85057f54957a9e2d9c8ed"
"gitHead": "4dfdc68e89ce9aeb3c38a970cfb38456f08f285f"
}
import debounce = require('lodash.debounce');
export * from './id';
export * from './array';

@@ -4,0 +5,0 @@ export * from './objects';

@@ -130,4 +130,8 @@ /********************************************************************************

*/
export function setByKey(target: any, key: string, newValue: any, autoCreateObject: boolean = true): boolean {
if (typeof target !== 'object' || !key) return false;
export function setByKey(target: any, key: string, newValue: any, autoCreateObject: boolean = true, clone?: boolean): any {
if (typeof target !== 'object' || !key) return target;
if (clone) {
target = { ...target };
}
const originTarget = target;
const targetKeys = key.split('.');

@@ -138,11 +142,14 @@ while (targetKeys.length > 0) {

target[key] = newValue;
return true;
return originTarget;
}
if (typeof target[key] !== 'object') {
if (!autoCreateObject) return false;
if (!autoCreateObject) return originTarget;
target[key] = {};
}
if (clone) {
target[key] = { ...target[key] };
}
target = target[key];
}
return false;
return originTarget;
}

@@ -149,0 +156,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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