Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
data-joint
Advanced tools
Perform data joins with any type of JavaScript objects.
import digest from 'data-joint';
or
const digest = require('data-joint');
or even
<script src="//unpkg.com/data-joint"></script>
then
const myData = [{ id: 0, val: 2 }, { id: 1, val: 4 }, { id: 2, val: 7 }];
const myView = new Set();
digest(myData, [...myView],
obj => myView.add(obj), // append obj
obj => myView.remove(obj), // remove obj
{
createObj: () => ({}),
updateObj: (obj, d) => { d.double = d.val * 2 },
exitObj: obj => { d.double = 0 },
idAccessor: d => d.id
}
);
digest(data, existingObjs, appendObjFn, removeObjFn, [{options}]);
data: An array of data points. Each point should be an object that supports attribute binding.
existingObjs: An array of view objects to join the data with.
appendObjFn: The method to add a new object to the view. The object is passed as single argument: obj => { ... }
.
removeObjFn: The method to remove an existing object from the view. The object is passed as single argument: obj => { ... }
.
An optional configuration object supporting the additional arguments:
Option | Description | Default |
---|---|---|
createObj | The method to create an entering view object for a new data point that does not have a corresponding object. The data point is passed as single argument: d => { ... } . The method should return a new object. | d => ({}) |
updateObj | The method to update an existing bound object with new data. The object and the data point are passed as arguments: (obj, d) => { ... } . This method is also called for entering objects after createObj . | (obj, d) => {} |
exitObj | The method to handle exiting objects which no longer have a corresponding data point. The unbound object is passed as single argument: obj => { ... } . This method is called prior to removing it from the view via removeObjectFn . | obj => {} |
objBindAttr | The attribute name used to bind data points to view objects. Each data point passed through the digest will be added this attribute, and it will be used for diffing across multiple iterations. | __obj |
dataBindAttr | The attribute name used to bind view objects to data points. Each object maintained by the digest will be added this attribute, and it will be used for diffing across multiple iterations. | __data |
idAccessor | A data point accessor function to extract the point unique identifier. This used for comparing data points across multiple iterations. If no idAccessor is supplied the, data point object reference will be used instead for comparisons. The data point is passed as single argument: d => {...} . The method should return a unique identifier. | undefined |
FAQs
Perform data joins with any type of JS objects
The npm package data-joint receives a total of 22,509 weekly downloads. As such, data-joint popularity was classified as popular.
We found that data-joint demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.