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

@finos/legend-shared

Package Overview
Dependencies
Maintainers
4
Versions
149
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@finos/legend-shared - npm Package Compare versions

Comparing version 3.0.2 to 4.0.0

2

lib/CommonUtils.d.ts

@@ -41,3 +41,3 @@ /**

*/
export declare const recursiveOmit: (obj: Record<PropertyKey, unknown>, keysToRemove: string[]) => Record<PropertyKey, unknown>;
export declare const recursiveOmit: (obj: Record<PropertyKey, unknown>, checker: (object: Record<PropertyKey, unknown>, propKey: PropertyKey) => boolean) => Record<PropertyKey, unknown>;
/**

@@ -44,0 +44,0 @@ * Recursively remove fields with undefined values in object

@@ -62,13 +62,17 @@ /**

*/
export const recursiveOmit = (obj, keysToRemove) => {
export const recursiveOmit = (obj,
/**
* Checker function which returns `true` if the object field should be omit
*/
checker) => {
const newObj = deepClone(obj);
const omit = (_obj, _keysToRemove) => {
for (const prop in _obj) {
if (Object.prototype.hasOwnProperty.call(_obj, prop)) {
const value = _obj[prop];
if (_keysToRemove.includes(prop)) {
delete _obj[prop];
const omit = (_obj, _checker) => {
for (const propKey in _obj) {
if (Object.prototype.hasOwnProperty.call(_obj, propKey)) {
const value = _obj[propKey];
if (_checker(_obj, propKey)) {
delete _obj[propKey];
}
else if (typeof value === 'object') {
omit(value, _keysToRemove);
omit(value, _checker);
}

@@ -78,3 +82,3 @@ }

};
omit(newObj, keysToRemove);
omit(newObj, checker);
return newObj;

@@ -81,0 +85,0 @@ };

{
"name": "@finos/legend-shared",
"version": "3.0.2",
"version": "4.0.0",
"description": "Legend Studio shared utilities and helpers",

@@ -52,3 +52,3 @@ "keywords": [

"lossless-json": "1.0.5",
"mobx": "6.6.0",
"mobx": "6.6.1",
"object-hash": "3.0.0",

@@ -55,0 +55,0 @@ "pako": "2.0.4",

{
"name": "@finos/legend-shared",
"version": "3.0.2",
"version": "4.0.0",
"description": "Legend Studio shared utilities and helpers",

@@ -52,3 +52,3 @@ "keywords": [

"lossless-json": "1.0.5",
"mobx": "6.6.0",
"mobx": "6.6.1",
"object-hash": "3.0.0",

@@ -63,3 +63,3 @@ "pako": "2.0.4",

"devDependencies": {
"@finos/legend-dev-utils": "2.0.1",
"@finos/legend-dev-utils": "2.0.2",
"@jest/globals": "28.1.1",

@@ -66,0 +66,0 @@ "cross-env": "7.0.3",

@@ -120,3 +120,9 @@ /**

obj: Record<PropertyKey, unknown>,
keysToRemove: string[],
/**
* Checker function which returns `true` if the object field should be omit
*/
checker: (
object: Record<PropertyKey, unknown>,
propKey: PropertyKey,
) => boolean,
): Record<PropertyKey, unknown> => {

@@ -126,11 +132,14 @@ const newObj = deepClone(obj);

_obj: Record<PropertyKey, unknown>,
_keysToRemove: string[],
_checker: (
object: Record<PropertyKey, unknown>,
propKey: string,
) => boolean,
): void => {
for (const prop in _obj) {
if (Object.prototype.hasOwnProperty.call(_obj, prop)) {
const value = _obj[prop] as Record<PropertyKey, unknown>;
if (_keysToRemove.includes(prop)) {
delete _obj[prop];
for (const propKey in _obj) {
if (Object.prototype.hasOwnProperty.call(_obj, propKey)) {
const value = _obj[propKey] as Record<PropertyKey, unknown>;
if (_checker(_obj, propKey)) {
delete _obj[propKey];
} else if (typeof value === 'object') {
omit(value, _keysToRemove);
omit(value, _checker);
}

@@ -140,3 +149,3 @@ }

};
omit(newObj, keysToRemove);
omit(newObj, checker);
return newObj;

@@ -143,0 +152,0 @@ };

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