Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
object-lib
Advanced tools
$ npm install --save-dev object-lib
For more extensive examples, please refer to the tests.
Align the ordering of one object recursively to a reference object.
Example:
const { align } = require('object-lib');
const obj = { k1: 1, k2: 2 };
const ref = { k2: null, k1: null };
align(obj, ref);
// obj => { k2: 1, k1: 2 }
Check if subtree
is contained in tree
recursively.
Different types are never considered contained.
Arrays are contained iff they are the same length and every element is contained in the corresponding element.
Objects are contained if the keys are a subset, and the respective values are contained.
All other types are contained if they match exactly (===
).
Example:
const { contain } = require('object-lib');
contain({ a: [1, 2], b: 'c' }, { a: [1, 2] });
// => true
contain({ a: [1, 2], b: 'c' }, { a: [1] });
// => false
Allows merging of objects. The logic defines paths that map to a field, or a function, to merge by.
If a function is passed, it is invoked with the value, and the result is used as the merge identifier.
The paths are defined using object-scan syntax.
Example:
const { Merge } = require('object-lig');
Merge()(
{ children: [{ id: 1 }, { id: 2 }] },
{ children: [{ id: 2 }, { id: 3 }] }
);
// => { children: [ { id: 1 }, { id: 2 }, { id: 2 }, { id: 3 } ] }
Merge({ '**[*]': 'id' })(
{ children: [{ id: 1 }, { id: 2 }] },
{ children: [{ id: 2 }, { id: 3 }] }
);
// => { children: [ { id: 1 }, { id: 2 }, { id: 3 } ] }
FAQs
Various object utility functions
The npm package object-lib receives a total of 541 weekly downloads. As such, object-lib popularity was classified as not popular.
We found that object-lib demonstrated a healthy version release cadence and project activity because the last version was released less than 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.