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

@appolo/utils

Package Overview
Dependencies
Maintainers
2
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@appolo/utils - npm Package Compare versions

Comparing version 8.0.50 to 8.0.51

18

lib/objects.js

@@ -97,2 +97,20 @@ "use strict";

}
static cloneJSON(json) {
if (typeof json !== 'object' || json === null) {
return json;
}
if (Array.isArray(json)) {
return json.map(value => (typeof value !== 'object' || value === null)
? value
: Objects.cloneJSON(value));
}
const output = {};
for (const key in json) {
const value = json[key];
output[key] = (typeof value !== 'object' || value === null)
? value
: Objects.cloneJSON(value);
}
return output;
}
static clone(obj) {

@@ -99,0 +117,0 @@ if (!obj) {

30

lib/objects.ts

@@ -34,3 +34,5 @@ import {Arrays} from "./arrays";

public static replaceFormatJson(obj: { [index: string]: any }, data: { [index: string]: any }): { [index: string]: any } {
public static replaceFormatJson(obj: { [index: string]: any }, data: { [index: string]: any }): {
[index: string]: any
} {
return JSON.parse(Strings.replaceFormatJson(JSON.stringify(obj), data));

@@ -56,3 +58,5 @@ }

public static invertBy<T extends { [index: string]: any }, K extends { [index: string]: any }>(obj: T, criteria: (value: T[keyof T], key: keyof T, i?: number) => string | number): K {
public static invertBy<T extends { [index: string]: any }, K extends {
[index: string]: any
}>(obj: T, criteria: (value: T[keyof T], key: keyof T, i?: number) => string | number): K {

@@ -126,3 +130,25 @@ let output = Object.keys(obj || {}).reduce((output, key, index: number) => {

public static cloneJSON<T>(json: T): T {
if (typeof json !== 'object' || json === null) {
return json;
}
if (Array.isArray(json)) {
return json.map(value =>
(typeof value !== 'object' || value === null)
? value
: Objects.cloneJSON(value)
) as any;
}
const output: any = {};
for (const key in json) {
const value = json[key];
output[key] = (typeof value !== 'object' || value === null)
? value
: Objects.cloneJSON(value)
}
return output;
}
public static clone<T>(obj: T): T {

@@ -129,0 +155,0 @@

14

package.json

@@ -20,3 +20,3 @@ {

"main": "./index.js",
"version": "8.0.50",
"version": "8.0.51",
"license": "MIT",

@@ -33,12 +33,12 @@ "repository": {

"devDependencies": {
"@types/benchmark": "^2.1.2",
"@types/chai": "^4.3.5",
"@types/mocha": "^10.0.1",
"@types/node": "^20.1.0",
"@types/benchmark": "^2.1.3",
"@types/chai": "^4.3.8",
"@types/mocha": "^10.0.2",
"@types/node": "^20.8.5",
"benchmark": "^2.1.4",
"chai": "^4.3.7",
"chai": "^4.3.10",
"mocha": "^10.2.0",
"tslib": "^2.5.0",
"tslib": "^2.6.2",
"typescript": "^4.9.5"
}
}

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