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

appolo-utils

Package Overview
Dependencies
Maintainers
1
Versions
60
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 0.0.34 to 0.0.35

20

lib/objects.js

@@ -5,4 +5,18 @@ "use strict";

static isPlain(obj) {
return Object.prototype.toString.call(obj) === '[object Object]';
if (!Objects.isObject(obj)) {
return false;
}
let ctor = obj.constructor;
if (typeof ctor !== 'function') {
return false;
}
let proto = ctor.prototype;
if (!Objects.isObject(proto) || !proto.hasOwnProperty('isPrototypeOf')) {
return false;
}
return true;
}
static isObject(val) {
return val != null && typeof val === 'object' && Object.prototype.toString.call(val) === '[object Object]';
}
static isEmpty(obj) {

@@ -33,3 +47,5 @@ return Object.keys(obj).length === 0;

let key = keys[i], value = obj[key];
output[key] = (value == null || typeof value != "object") ? value : Objects.cloneDeep(value);
output[key] = (value !== null && value !== undefined && (Array.isArray(value) || Objects.isPlain(value)))
? Objects.cloneDeep(value)
: value;
}

@@ -36,0 +52,0 @@ return output;

export class Objects {
public static isPlain(obj: { [index: string]: string | number | boolean }): boolean {
return Object.prototype.toString.call(obj) === '[object Object]';
public static isPlain(obj: any): boolean {
if (!Objects.isObject(obj)) {
return false;
}
let ctor = obj.constructor;
if (typeof ctor !== 'function') {
return false;
}
let proto = ctor.prototype;
if (!Objects.isObject(proto) || !proto.hasOwnProperty('isPrototypeOf')) {
return false;
}
return true;
}
public static isObject(val: any): boolean {
return val != null && typeof val === 'object' && Object.prototype.toString.call(val) === '[object Object]';
}
public static isEmpty(obj: { [index: string]: any }): boolean {

@@ -39,3 +59,5 @@ return Object.keys(obj).length === 0

let key = keys[i], value = obj[key];
output[key] = (value == null || typeof value != "object") ? value : Objects.cloneDeep(value)
output[key] = (value !== null && value !== undefined && (Array.isArray(value) || Objects.isPlain(value)))
? Objects.cloneDeep(value)
: value
}

@@ -42,0 +64,0 @@

2

package.json

@@ -17,3 +17,3 @@ {

"main": "./index.js",
"version": "0.0.34",
"version": "0.0.35",
"license": "MIT",

@@ -20,0 +20,0 @@ "repository": {

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