
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
js-mockdata-registry
Advanced tools
JavaScript registry or mockdata
The js-mockdata-registry is a small registry for mockdata objects that should be references within other mockdata objects.
Simply add the js-mockdata-registry to your package.json file and use npm install for installation.
"devDependencies": {
"js-mockdata-registry": "~1.0.0"
}
Once it is installed you can require the module.
let mockdata = require('js-mockdata-registry')
This chapter explains the basic usage of the registry.
| Method | Description |
| --- | --- | --- |
| addObject (Object obj) | Adds the given object to the registry. The object must have the attribute mark with a unique value within the registry. The markis consumed in the registration process. An error is throw if either the attribute mark is not exisiting or if its value is not unique |
| hasObject (String mark) : Boolean | Checks the registry if an object with the given mark exists|
| getObject (String mark) | Reads the desired registry entry for the given mark. Throws an error if the given mark is not existing in the registry. |
| removeObject (String mark) | Removes the desired registry entry for the given mark. Throws an error if the given mark is not existing in the registry. |
| log (Number depth) | Outputs the current registry using node's util.inspect function. The depth is handed over to the inspect function. |
| resolve (Object resultObj, Object obj, String attrib) | This function resolves an object reference to an registry entry. The originial obj won't be changed during resolve. Instead the resultObj will be altered. For more details see the examples. |
/* in order to add objects we have to instanciate the registry */
let mockdata = require('js-mockdata-registry')
/* adding objects */
mockdata.registry.addObject({
mark: 'User.John',
firstname: 'John',
lastname: 'Doe'
})
/* reading objects */
mockdata.registry.getObject('User.John')
/* resolving references */
// define the new object with a objectRef to an existing mark
let project = {
desc: 'first project',
supervisor: { objectRef: 'User.John' }
}
// clone the base object
let resolvedProject = Object.assign({}, project)
// let the registry resolve the object reference
mockdata.registry.resolve(resolvedProject, project, 'supervisor')
FAQs
JavaScript registry for mockdata
The npm package js-mockdata-registry receives a total of 5 weekly downloads. As such, js-mockdata-registry popularity was classified as not popular.
We found that js-mockdata-registry 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.