Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
JavaScript library that allows you to build a request to multiple sources, combine responses and transform the result according to a scheme.
JavaScript library that allows you to build a request to multiple sources, combine responses and transform the result according to a scheme.
Install library via npm:
$ npm install dataccom
The main idea is to allow the developer to compose a query to multiple sources, retrieve the data and transform it according to the scheme.
First of all, you need to open an interface and then you can build a chain of functions with lazy method fetch
.
Feel free to pass both simple and asynchronous functions. If you want to apply a scheme, use
method apply
to pass it. Note, if you call this method multiple times the scheme will
be rewrited. Finally, if you ready to get the data - use method collect
that returns a promise.
const dataccom = require('dataccom');
const scheme = {
name: String,
age: Number,
university: String,
specialty: String,
};
const userId = 10;
const result = dataccom
.chain()
.fetch(getUserData, userId)
.fetch(getUserEducation, userId)
.apply(scheme)
.collect();
console.log(result);
/*
The result is:
{
name: 'John',
age: 20,
university: 'Stanford University',
specialty: 'Software Engineering'
}
*/
Scheme is an object that contains fields names and it types (constructors). It can contain inner objects and arrays. All items of arrays must be of the same type. To specify an array type - use the next syntax:
const scheme = {
faculty: String,
specialty: String,
students: [String], // Array of Strings
};
Note, if you want to use a specific constructor (like User
class) you should pass a function
that returns User
instance, instead of passing User
type.
FAQs
JavaScript library that allows you to build a request to multiple sources, combine responses and transform the result according to a scheme.
We found that dataccom 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.