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

@aesthetic/utils

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aesthetic/utils - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

lib/deepClone.d.ts

46

esm/index.js

@@ -1,2 +0,1 @@

import extend from 'extend';
import hash from 'string-hash';

@@ -31,3 +30,25 @@

function objectLoop(object, callback) {
arrayLoop(Object.keys(object), function (key) {
return callback(object[key], key);
});
}
function isObject(value) {
return value !== null && !Array.isArray(value) && typeof value === 'object';
}
function merge(base, next) {
objectLoop(next, function (right, key) {
if (isObject(right)) {
base[key] = deepMerge(base[key], right);
} else {
base[key] = right;
}
});
return base;
}
function deepMerge() {
var result = {};
for (var _len = arguments.length, objects = new Array(_len), _key = 0; _key < _len; _key++) {

@@ -37,5 +58,14 @@ objects[_key] = arguments[_key];

return extend.apply(void 0, [true, {}].concat(objects));
arrayLoop(objects, function (object) {
if (isObject(object)) {
merge(result, object);
}
});
return result;
}
function deepClone(object) {
return merge({}, object);
}
function generateHash(value) {

@@ -67,6 +97,2 @@ return hash(value).toString(36);

function isObject(value) {
return value !== null && !Array.isArray(value) && typeof value === 'object';
}
function isSSR() {

@@ -76,8 +102,2 @@ return typeof window === 'undefined' || typeof document === 'undefined';

function objectLoop(object, callback) {
arrayLoop(Object.keys(object), function (key) {
return callback(object[key], key);
});
}
function objectReduce(object, callback, initialValue) {

@@ -101,2 +121,2 @@ if (initialValue === void 0) {

export { arrayLoop, arrayReduce, deepMerge, generateHash, hyphenate, isObject, isSSR, objectLoop, objectReduce, toArray };
export { arrayLoop, arrayReduce, deepClone, deepMerge, generateHash, hyphenate, isObject, isSSR, objectLoop, objectReduce, toArray };

@@ -1,2 +0,3 @@

export default function deepMerge<T = object>(...objects: object[]): T;
export declare function merge(base: object, next: object): object;
export default function deepMerge<T = object>(...objects: unknown[]): T;
//# sourceMappingURL=deepMerge.d.ts.map

@@ -7,2 +7,3 @@ /**

import arrayReduce from './arrayReduce';
import deepClone from './deepClone';
import deepMerge from './deepMerge';

@@ -16,3 +17,3 @@ import generateHash from './generateHash';

import toArray from './toArray';
export { arrayLoop, arrayReduce, deepMerge, generateHash, hyphenate, isObject, isSSR, objectLoop, objectReduce, toArray, };
export { arrayLoop, arrayReduce, deepClone, deepMerge, generateHash, hyphenate, isObject, isSSR, objectLoop, objectReduce, toArray, };
//# sourceMappingURL=index.d.ts.map

@@ -7,3 +7,2 @@ 'use strict';

var extend = _interopDefault(require('extend'));
var hash = _interopDefault(require('string-hash'));

@@ -38,3 +37,25 @@

function objectLoop(object, callback) {
arrayLoop(Object.keys(object), function (key) {
return callback(object[key], key);
});
}
function isObject(value) {
return value !== null && !Array.isArray(value) && typeof value === 'object';
}
function merge(base, next) {
objectLoop(next, function (right, key) {
if (isObject(right)) {
base[key] = deepMerge(base[key], right);
} else {
base[key] = right;
}
});
return base;
}
function deepMerge() {
var result = {};
for (var _len = arguments.length, objects = new Array(_len), _key = 0; _key < _len; _key++) {

@@ -44,5 +65,14 @@ objects[_key] = arguments[_key];

return extend.apply(void 0, [true, {}].concat(objects));
arrayLoop(objects, function (object) {
if (isObject(object)) {
merge(result, object);
}
});
return result;
}
function deepClone(object) {
return merge({}, object);
}
function generateHash(value) {

@@ -74,6 +104,2 @@ return hash(value).toString(36);

function isObject(value) {
return value !== null && !Array.isArray(value) && typeof value === 'object';
}
function isSSR() {

@@ -83,8 +109,2 @@ return typeof window === 'undefined' || typeof document === 'undefined';

function objectLoop(object, callback) {
arrayLoop(Object.keys(object), function (key) {
return callback(object[key], key);
});
}
function objectReduce(object, callback, initialValue) {

@@ -110,2 +130,3 @@ if (initialValue === void 0) {

exports.arrayReduce = arrayReduce;
exports.deepClone = deepClone;
exports.deepMerge = deepMerge;

@@ -112,0 +133,0 @@ exports.generateHash = generateHash;

{
"name": "@aesthetic/utils",
"version": "0.1.0",
"version": "0.1.1",
"description": "Utility functions for Aesthetic.",

@@ -20,3 +20,2 @@ "keywords": [

"dependencies": {
"extend": "^3.0.2",
"string-hash": "^1.1.3"

@@ -28,3 +27,3 @@ },

},
"gitHead": "9ec9db033887e32ea1b5d5dfcb4e5c87dad3dfc3"
"gitHead": "709ef9a4847dbdb8566fd756ce49f2cc33507393"
}

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