
Research
/Security News
Malicious npm Packages Target WhatsApp Developers with Remote Kill Switch
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
assembly_line
Advanced tools
Simple, reusable javascript object factories – great for writing tests.
Basic usage:
var AssemblyLine = require('assembly_line');
// define a factory
var user = AssemblyLine.factory(Object, {
firstName: 'Jane',
lastName: 'Smith',
email: 'jsmith@example.com'
})
// call the factory to create an instance
var jsmith = user();
The Factory method accepts two arguments: the constructor class you want to use for your objects and a set of attributes to user when creating instances.
Example:
// define a custom constructor
var User = function(params) {
this.params = params;
}
// define factories
var Factories = {
jason: AssemblyLine.factory(User, {
name: 'Jason',
hometown: 'Jackson, Mississippi'
})
}
var jason = Factories.jason();
console.log(jason);
// => { params: { name: 'Jason', hometown: 'Jackson, Mississippi' }}
The Sample method accepts one argument: an array or options to choose from. When a factory's attribute is set using the sample method, new instances will be created and assigned a random value from the options array.
Example:
var user = AssemblyLine.factory(Object, {
name: AssemblyLine.sample([
'james', 'jason', 'jenny', 'janice'
])
})
var user1 = user();
// user1.name will be one of james, jason, jenny, or janice
The Increment method accepts one argument: a string that should be used as the base value to increment on. When a factory's attribute is set using the increment method, new instances will be created by replacing #{i}
with an incrementing integer. This is useful for ensuring unique email addresses, etc when testing.
Example:
var user = AssemblyLine.factory(Object, {
email: AssemblyLine.incr('person#{i}@example.com')
})
var user1 = user();
// user1.email => person1@example.com
var user2 = user();
// user2.email => person2@example.com
FAQs
Javascript object factories
We found that assembly_line 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
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
Research
/Security News
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.