
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
factory-girl
Advanced tools
factory-girl
is a factory library for Node.js / JavaScript inspired by Factory_girl. It works asynchronously and supports lazy attributes as well as associations.
It is based on factory-lady, but uses an adapter to talk to your models (and doesn't use throw
for errors that might occur during save).
Node.js:
npm install factory-girl
To use factory-girl
in the browser or other JavaScript environments, just include index.js
.
JavaScript:
var factory = require('factory-lady'),
User = require('../../app/models/user'),
Post = require('../../app/models/post');
var emailCounter = 1;
factory.define('user', User, {
email : function() { return 'user' + emailCounter++ + '@example.com'; }, // lazy attribute
async : function(cb) { somethingAsync(cb); }, // async lazy attribute
state : 'activated',
password : '123456'
});
factory.define('post', Post, {
user_id : factory.assoc('user', 'id') // simply factory.assoc('user') for user object itself,
subject : 'Hello World',
content : 'Lorem ipsum dolor sit amet...'
});
JavaScript:
factory.build('post', function(err, post) {
// post is a Post instance that is not saved
});
factory.build('post', {title: 'Foo', content: 'Bar'}, function(err, post) {
// build a post and override title and content
});
factory.create('post', function(err, post) {
// post is a saved Post instance
});
factory('post', function(err, post) {
// same as factory.create
});
Copyright (c) 2011 Peter Jihoon Kim. This software is licensed under the MIT License. Copyright (c) 2014 Simon Wade. This software is licensed under the MIT License.
FAQs
A factory library for Node.js and JavaScript inspired by factory_girl
The npm package factory-girl receives a total of 33,196 weekly downloads. As such, factory-girl popularity was classified as popular.
We found that factory-girl 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
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.