New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ukon1990/js-utilities

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ukon1990/js-utilities - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

2

dist/utils/object.util.d.ts

@@ -8,4 +8,4 @@ import { Difference } from "../models/difference.model";

private static cloneField;
static isEqual(object1: Object, object2: Object): boolean;
static isEqual(object1: object, object2: object): boolean;
static getDifference(object1: object | any, object2: object | any, ignoreFields?: any): Array<Difference>;
}

@@ -48,11 +48,11 @@ "use strict";

}
static cloneField(object, key, obj) {
static cloneField(object, key, targetObject) {
if (array_util_1.ArrayUtil.isArray(object[key])) {
obj[key] = array_util_1.ArrayUtil.clone(object[key]);
targetObject[key] = array_util_1.ArrayUtil.clone(object[key]);
}
else if (ObjectUtil.isObject(object[key])) {
obj[key] = ObjectUtil.clone(object[key]);
targetObject[key] = ObjectUtil.clone(object[key]);
}
else {
obj[key] = object[key];
targetObject[key] = object[key];
}

@@ -59,0 +59,0 @@ }

{
"name": "@ukon1990/js-utilities",
"version": "0.0.3",
"version": "0.0.4",
"description": "A light weight package for object and array manipulation. As well as some utilities for matching text.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

# Javascript utilities
This is a small package with some utilities.
More description inc later.
## ObjectUtil
* `isObject(value)` - Checks if a value is an object and not array
* `overwrite(fromObject, toObject)` - Replaces all the values of one objects with another object
* `clone(object)` - Returns a cloned version of an object. Removing all child object references.
* `isEqual(object1, object2)` - Checks if two objects are equal regardless of object reference.
* `getDifference(object1, object2)` - Returns an array of object differences as `Difference` objects.
## ArrayUtil
* `isObject(value)` - Checks if a value is an object and not array
* `overwrite(fromArray, toArray)` - Replaces all the values of one array with another array
* `clone(array)` - Returns a cloned version of an array. Removing all child object references.
* `isEqual(array1, array2)` - Checks if two arrays are equal regardless of object reference.
* `getDifference(array1, array2)` - Returns an array of differences as `Difference` objects.
## TextUtil
* `getMatchingParts(string, stringToFind)` -
Returns a Match object. The Match object for `getMatchingParts('Chicken', 'ck')`
looks like this `{start: 'Chi', match: 'ck', end: 'en'}`.
* `getIndexOf(sourceString, targetString)` - Is basically `sourceString.toLowerCase().indexOf(targetString.toLowerCase)`
* `contains(sourceString, targetString)` - Checks if a string exists within another. This is case-insensitive.
* `isLowerCase(string)` - Checks if a string is upper or lowercase.

@@ -51,13 +51,13 @@ import {EmptyUtil} from "./empty.util";

private static cloneField(object: any, key: string, obj: any) {
private static cloneField(object: any, key: string, targetObject: any) {
if (ArrayUtil.isArray(object[key])) {
obj[key] = ArrayUtil.clone(object[key]);
targetObject[key] = ArrayUtil.clone(object[key]);
} else if (ObjectUtil.isObject(object[key])) {
obj[key] = ObjectUtil.clone(object[key]);
targetObject[key] = ObjectUtil.clone(object[key]);
} else {
obj[key] = object[key];
targetObject[key] = object[key];
}
}
public static isEqual(object1: Object, object2: Object): boolean {
public static isEqual(object1: object, object2: object): boolean {
return ObjectUtil.getDifference(object1, object2).length === 0;

@@ -64,0 +64,0 @@ }

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