Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

object-array-utils

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-array-utils - npm Package Compare versions

Comparing version
1.1.1
to
1.1.2
+1
-1
package.json
{
"name": "object-array-utils",
"version": "1.1.1",
"version": "1.1.2",
"description": "Utilities for working with arrays and objects",

@@ -5,0 +5,0 @@ "scripts": {

@@ -245,8 +245,8 @@ function isNullOrUndefined(v) {

function deepFreeze(o) {
if (!isObject(o)) {
throw new Error('expected object');
if (!isObject(o) && !isArray(o)) {
throw new Error('expected object or array');
}
Object.keys(o).forEach(prop => {
if (typeof o[prop] === 'object' && !Object.isFrozen(o[prop])) {
if ((!isObject(o[prop]) || !isArray(o[prop])) && !Object.isFrozen(o[prop])) {
deepFreeze(o[prop]);

@@ -253,0 +253,0 @@ }

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

import { areArraysEqual, areObjectsEqual } from './index';
import { areArraysEqual, areObjectsEqual, deepFreeze } from './index';

@@ -58,2 +58,4 @@ test('object equality', () => {

).toBeTruthy();
deepFreeze([1, { b: null, c: { d: [2, 5, 1, 0, {c: 3, d: 4}], e: "world" }, a: "foo" }]);
});