0.0.5 • Published 1 year ago

@mindzgroup/utilities v0.0.5

Weekly downloads
1
License
ISC
Repository
github
Last release
1 year ago

Productivity Utility Functions for JavaScript / TypeScript

A collection of commonly used utility function.

List of Functions

GetNestedPropertyValue

Signature

GetNestedPropertyValue: <T>(obj: any, propPath: string, returnUndefined?: boolean) => T;

Sample Usage: TypeScript

import { GetNestedPropertyValue } from '@mindzgroup/utilities';

let dataObject = { ... };

let value = GetNestedPropertyValue(dataObject, 'path.to.property');

SetNestedPropertyValue

Note: this function modifies the target object and overwrites the existing value at the given path by default. In case your requirement want the values to be merged at destination please use mergeValue = true as the function parameter.

Signature

SetNestedPropertyValue: (target: any, path: string, value: any, mergeValue?: boolean): boolean;

Sample Usage: TypeScript

import { SetNestedPropertyValue } from '@mindzgroup/utilities';

let dataObject = { ... };
let value: string = 'value';

// without merge
SetNestedPropertyValue(dataObject, 'path.to.property', value);

// with merge
SetNestedPropertyValue(dataObject, 'path.to.property', value, true);
0.0.5

1 year ago

0.0.4

4 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago