Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@types/object-path
Advanced tools
@types/object-path provides TypeScript type definitions for the object-path library, which allows for easy manipulation and access of deep properties within JavaScript objects.
Get a value at a given path
This feature allows you to retrieve the value at a specified path within an object. If the path does not exist, it returns undefined.
const objectPath = require('object-path');
const obj = { a: { b: { c: 42 } } };
const value = objectPath.get(obj, 'a.b.c');
console.log(value); // 42
Set a value at a given path
This feature allows you to set a value at a specified path within an object. If the path does not exist, it will be created.
const objectPath = require('object-path');
const obj = { a: { b: { } } };
objectPath.set(obj, 'a.b.c', 42);
console.log(obj); // { a: { b: { c: 42 } } }
Delete a value at a given path
This feature allows you to delete the value at a specified path within an object. If the path does not exist, the object remains unchanged.
const objectPath = require('object-path');
const obj = { a: { b: { c: 42 } } };
objectPath.del(obj, 'a.b.c');
console.log(obj); // { a: { b: { } } }
Check if a path exists
This feature allows you to check if a specified path exists within an object. It returns true if the path exists, otherwise false.
const objectPath = require('object-path');
const obj = { a: { b: { c: 42 } } };
const exists = objectPath.has(obj, 'a.b.c');
console.log(exists); // true
Lodash is a popular utility library that provides a wide range of functions for manipulating arrays, objects, and other data types. It includes similar functionalities for deep property access and manipulation, such as _.get, _.set, and _.has. Compared to object-path, Lodash offers a broader set of utilities beyond just object manipulation.
dot-prop is a small utility for accessing and manipulating object properties using dot notation. It provides similar functionalities to object-path, such as get, set, delete, and has methods. dot-prop is lightweight and focused specifically on property access and manipulation, making it a good alternative for those who need a minimalistic solution.
Deepdash is an extension for Lodash that adds deep traversal and manipulation capabilities. It provides similar functionalities to object-path, such as deep get, set, and delete operations. Deepdash is useful for those who are already using Lodash and need additional deep manipulation features.
npm install --save @types/object-path
This package contains type definitions for objectPath (https://github.com/mariocasciaro/object-path).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/object-path.
These definitions were written by Paulo Cesar, and BendingBender.
FAQs
TypeScript definitions for object-path
The npm package @types/object-path receives a total of 214,436 weekly downloads. As such, @types/object-path popularity was classified as popular.
We found that @types/object-path demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.