New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

rosie

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rosie - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

6

package.json
{
"name": "rosie",
"version": "1.0.0",
"version": "1.1.0",
"description": "factory for building JavaScript objects, mostly useful for setting up test data. Inspired by factory_girl",

@@ -11,3 +11,5 @@ "keywords": [

"author": "Brandon Keepers <brandon@opensoul.org>",
"contributors": [],
"contributors": [
"Brian Donovan <me@brian-donovan.com>"
],
"dependencies": {},

@@ -14,0 +16,0 @@ "devDependencies": {

# Rosie
[![Build Status](https://travis-ci.org/rosiejs/rosie.svg?branch=master)](https://travis-ci.org/rosiejs/rosie)
![Rosie the Riveter](http://upload.wikimedia.org/wikipedia/commons/thumb/1/12/We_Can_Do_It%21.jpg/220px-We_Can_Do_It%21.jpg)

@@ -9,6 +11,6 @@

Define your factory, giving it a name and optionally a constructor function:
Define your factory, giving it a name and optionally a constructor function (`Game` in this example):
```js
Factory.define('game', Game)
Factory.define('game'/*, Game*/)
.sequence('id')

@@ -88,2 +90,51 @@ .attr('is_over', false)

### Node.js
To use Rosie in node, you'll need to require it first:
```js
var Factory = require('rosie').Factory;
```
You might also choose to use unregistered factories, as it fits better with node's module pattern:
```js
// factories/game.js
var Factory = require('rosie').Factory;
module.exports = new Factory()
.sequence('id')
.attr('is_over', false)
// etc
```
To use the unregistered `Game` factory defined above:
```js
var Game = require('./factories/game');
var game = Game.build({is_over: true});
```
#### ES6
Unregistered factories are even more natural in ES6:
```js
// factories/game.js
import { Factory } from 'rosie';
export default new Factory()
.sequence('id')
.attr('is_over', false)
// etc
// index.js
import Game from './factories/game');
const game = Game.build({is_over: true});
```
A tool like [babel](https://babeljs.io) is currently required to use this syntax.
## Contributing

@@ -90,0 +141,0 @@

@@ -431,4 +431,8 @@ /**

if (typeof exports !== 'undefined') {
if (typeof exports === 'object' && typeof module !== 'undefined') {
exports.Factory = Factory;
} else if (typeof define === 'function' && define.amd) {
define([], Factory);
} else if (this) {
this.Factory = Factory;
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc