factory-girl
Advanced tools
Comparing version 5.0.0 to 5.0.1
@@ -7,2 +7,3 @@ import _slicedToArray from 'babel-runtime/helpers/slicedToArray'; | ||
import _asyncToGenerator from 'babel-runtime/helpers/asyncToGenerator'; | ||
import _Object$assign from 'babel-runtime/core-js/object/assign'; | ||
import _Set from 'babel-runtime/core-js/set'; | ||
@@ -17,3 +18,2 @@ import _classCallCheck from 'babel-runtime/helpers/classCallCheck'; | ||
import Chance from 'chance'; | ||
import _Object$assign from 'babel-runtime/core-js/object/assign'; | ||
@@ -816,12 +816,29 @@ /* eslint-disable no-underscore-dangle */ | ||
key: 'define', | ||
value: function define(name, Model, initializer, options) { | ||
value: function define(name, Model, initializer) { | ||
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; | ||
if (this.getFactory(name, false)) { | ||
throw new Error('Factory ' + name + ' already defined'); | ||
} | ||
this.factories[name] = new Factory(Model, initializer, options); | ||
var factory = this.factories[name] = new Factory(Model, initializer, options); | ||
return factory; | ||
} | ||
}, { | ||
key: 'extend', | ||
value: function extend(parent, name, initializer) { | ||
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; | ||
if (this.getFactory(name, false)) { | ||
throw new Error('Factory ' + name + ' already defined'); | ||
} | ||
var parentFactory = this.getFactory(parent, true); | ||
var Model = options.model || parentFactory.Model; | ||
var factory = this.factories[name] = new Factory(Model, _Object$assign({}, parentFactory.initializer, initializer), options); | ||
return factory; | ||
} | ||
}, { | ||
key: 'attrs', | ||
value: function () { | ||
var _ref = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(name, _attrs, buildOptions) { | ||
var _ref = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(name, _attrs) { | ||
var buildOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
return _regeneratorRuntime.wrap(function _callee$(_context) { | ||
@@ -841,3 +858,3 @@ while (1) { | ||
function attrs(_x2, _x3, _x4) { | ||
function attrs(_x4, _x5) { | ||
return _ref.apply(this, arguments); | ||
@@ -874,3 +891,3 @@ } | ||
function build(_x5) { | ||
function build(_x7) { | ||
return _ref2.apply(this, arguments); | ||
@@ -884,5 +901,6 @@ } | ||
value: function () { | ||
var _ref3 = _asyncToGenerator(_regeneratorRuntime.mark(function _callee3(name, attrs, buildOptions) { | ||
var _ref3 = _asyncToGenerator(_regeneratorRuntime.mark(function _callee3(name, attrs) { | ||
var _this3 = this; | ||
var buildOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var adapter; | ||
@@ -908,3 +926,3 @@ return _regeneratorRuntime.wrap(function _callee3$(_context3) { | ||
function create(_x8, _x9, _x10) { | ||
function create(_x10, _x11) { | ||
return _ref3.apply(this, arguments); | ||
@@ -917,3 +935,5 @@ } | ||
key: 'attrsMany', | ||
value: function attrsMany(name, num, attrs, buildOptions) { | ||
value: function attrsMany(name, num, attrs) { | ||
var buildOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; | ||
return this.getFactory(name).attrsMany(num, attrs, buildOptions); | ||
@@ -924,5 +944,6 @@ } | ||
value: function () { | ||
var _ref4 = _asyncToGenerator(_regeneratorRuntime.mark(function _callee4(name, num, attrs, buildOptions) { | ||
var _ref4 = _asyncToGenerator(_regeneratorRuntime.mark(function _callee4(name, num, attrs) { | ||
var _this4 = this; | ||
var buildOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; | ||
var adapter; | ||
@@ -948,3 +969,3 @@ return _regeneratorRuntime.wrap(function _callee4$(_context4) { | ||
function buildMany(_x11, _x12, _x13, _x14) { | ||
function buildMany(_x14, _x15, _x16) { | ||
return _ref4.apply(this, arguments); | ||
@@ -958,5 +979,6 @@ } | ||
value: function () { | ||
var _ref5 = _asyncToGenerator(_regeneratorRuntime.mark(function _callee5(name, num, attrs, buildOptions) { | ||
var _ref5 = _asyncToGenerator(_regeneratorRuntime.mark(function _callee5(name, num, attrs) { | ||
var _this5 = this; | ||
var buildOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; | ||
var adapter; | ||
@@ -984,3 +1006,3 @@ return _regeneratorRuntime.wrap(function _callee5$(_context5) { | ||
function createMany(_x15, _x16, _x17, _x18) { | ||
function createMany(_x18, _x19, _x20) { | ||
return _ref5.apply(this, arguments); | ||
@@ -987,0 +1009,0 @@ } |
48
index.js
@@ -13,2 +13,3 @@ 'use strict'; | ||
var _asyncToGenerator = _interopDefault(require('babel-runtime/helpers/asyncToGenerator')); | ||
var _Object$assign = _interopDefault(require('babel-runtime/core-js/object/assign')); | ||
var _Set = _interopDefault(require('babel-runtime/core-js/set')); | ||
@@ -23,3 +24,2 @@ var _classCallCheck = _interopDefault(require('babel-runtime/helpers/classCallCheck')); | ||
var Chance = _interopDefault(require('chance')); | ||
var _Object$assign = _interopDefault(require('babel-runtime/core-js/object/assign')); | ||
@@ -822,12 +822,29 @@ /* eslint-disable no-underscore-dangle */ | ||
key: 'define', | ||
value: function define(name, Model, initializer, options) { | ||
value: function define(name, Model, initializer) { | ||
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; | ||
if (this.getFactory(name, false)) { | ||
throw new Error('Factory ' + name + ' already defined'); | ||
} | ||
this.factories[name] = new Factory(Model, initializer, options); | ||
var factory = this.factories[name] = new Factory(Model, initializer, options); | ||
return factory; | ||
} | ||
}, { | ||
key: 'extend', | ||
value: function extend(parent, name, initializer) { | ||
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; | ||
if (this.getFactory(name, false)) { | ||
throw new Error('Factory ' + name + ' already defined'); | ||
} | ||
var parentFactory = this.getFactory(parent, true); | ||
var Model = options.model || parentFactory.Model; | ||
var factory = this.factories[name] = new Factory(Model, _Object$assign({}, parentFactory.initializer, initializer), options); | ||
return factory; | ||
} | ||
}, { | ||
key: 'attrs', | ||
value: function () { | ||
var _ref = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(name, _attrs, buildOptions) { | ||
var _ref = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(name, _attrs) { | ||
var buildOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
return _regeneratorRuntime.wrap(function _callee$(_context) { | ||
@@ -847,3 +864,3 @@ while (1) { | ||
function attrs(_x2, _x3, _x4) { | ||
function attrs(_x4, _x5) { | ||
return _ref.apply(this, arguments); | ||
@@ -880,3 +897,3 @@ } | ||
function build(_x5) { | ||
function build(_x7) { | ||
return _ref2.apply(this, arguments); | ||
@@ -890,5 +907,6 @@ } | ||
value: function () { | ||
var _ref3 = _asyncToGenerator(_regeneratorRuntime.mark(function _callee3(name, attrs, buildOptions) { | ||
var _ref3 = _asyncToGenerator(_regeneratorRuntime.mark(function _callee3(name, attrs) { | ||
var _this3 = this; | ||
var buildOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var adapter; | ||
@@ -914,3 +932,3 @@ return _regeneratorRuntime.wrap(function _callee3$(_context3) { | ||
function create(_x8, _x9, _x10) { | ||
function create(_x10, _x11) { | ||
return _ref3.apply(this, arguments); | ||
@@ -923,3 +941,5 @@ } | ||
key: 'attrsMany', | ||
value: function attrsMany(name, num, attrs, buildOptions) { | ||
value: function attrsMany(name, num, attrs) { | ||
var buildOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; | ||
return this.getFactory(name).attrsMany(num, attrs, buildOptions); | ||
@@ -930,5 +950,6 @@ } | ||
value: function () { | ||
var _ref4 = _asyncToGenerator(_regeneratorRuntime.mark(function _callee4(name, num, attrs, buildOptions) { | ||
var _ref4 = _asyncToGenerator(_regeneratorRuntime.mark(function _callee4(name, num, attrs) { | ||
var _this4 = this; | ||
var buildOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; | ||
var adapter; | ||
@@ -954,3 +975,3 @@ return _regeneratorRuntime.wrap(function _callee4$(_context4) { | ||
function buildMany(_x11, _x12, _x13, _x14) { | ||
function buildMany(_x14, _x15, _x16) { | ||
return _ref4.apply(this, arguments); | ||
@@ -964,5 +985,6 @@ } | ||
value: function () { | ||
var _ref5 = _asyncToGenerator(_regeneratorRuntime.mark(function _callee5(name, num, attrs, buildOptions) { | ||
var _ref5 = _asyncToGenerator(_regeneratorRuntime.mark(function _callee5(name, num, attrs) { | ||
var _this5 = this; | ||
var buildOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; | ||
var adapter; | ||
@@ -990,3 +1012,3 @@ return _regeneratorRuntime.wrap(function _callee5$(_context5) { | ||
function createMany(_x15, _x16, _x17, _x18) { | ||
function createMany(_x18, _x19, _x20) { | ||
return _ref5.apply(this, arguments); | ||
@@ -993,0 +1015,0 @@ } |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('babel-runtime/helpers/slicedToArray'), require('babel-runtime/core-js/get-iterator'), require('babel-runtime/helpers/extends'), require('babel-runtime/core-js/promise'), require('babel-runtime/regenerator'), require('babel-runtime/helpers/asyncToGenerator'), require('babel-runtime/core-js/set'), require('babel-runtime/helpers/classCallCheck'), require('babel-runtime/helpers/createClass'), require('babel-runtime/core-js/object/keys'), require('babel-runtime/helpers/typeof'), require('babel-runtime/core-js/object/get-prototype-of'), require('babel-runtime/helpers/possibleConstructorReturn'), require('babel-runtime/helpers/inherits'), require('chance'), require('babel-runtime/core-js/object/assign')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'babel-runtime/helpers/slicedToArray', 'babel-runtime/core-js/get-iterator', 'babel-runtime/helpers/extends', 'babel-runtime/core-js/promise', 'babel-runtime/regenerator', 'babel-runtime/helpers/asyncToGenerator', 'babel-runtime/core-js/set', 'babel-runtime/helpers/classCallCheck', 'babel-runtime/helpers/createClass', 'babel-runtime/core-js/object/keys', 'babel-runtime/helpers/typeof', 'babel-runtime/core-js/object/get-prototype-of', 'babel-runtime/helpers/possibleConstructorReturn', 'babel-runtime/helpers/inherits', 'chance', 'babel-runtime/core-js/object/assign'], factory) : | ||
(factory((global.Factory = global.Factory || {}),global._slicedToArray,global._getIterator,global._extends,global._Promise,global._regeneratorRuntime,global._asyncToGenerator,global._Set,global._classCallCheck,global._createClass,global._Object$keys,global._typeof,global._Object$getPrototypeOf,global._possibleConstructorReturn,global._inherits,global.Chance,global._Object$assign)); | ||
}(this, function (exports,_slicedToArray,_getIterator,_extends,_Promise,_regeneratorRuntime,_asyncToGenerator,_Set,_classCallCheck,_createClass,_Object$keys,_typeof,_Object$getPrototypeOf,_possibleConstructorReturn,_inherits,Chance,_Object$assign) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('babel-runtime/helpers/slicedToArray'), require('babel-runtime/core-js/get-iterator'), require('babel-runtime/helpers/extends'), require('babel-runtime/core-js/promise'), require('babel-runtime/regenerator'), require('babel-runtime/helpers/asyncToGenerator'), require('babel-runtime/core-js/object/assign'), require('babel-runtime/core-js/set'), require('babel-runtime/helpers/classCallCheck'), require('babel-runtime/helpers/createClass'), require('babel-runtime/core-js/object/keys'), require('babel-runtime/helpers/typeof'), require('babel-runtime/core-js/object/get-prototype-of'), require('babel-runtime/helpers/possibleConstructorReturn'), require('babel-runtime/helpers/inherits'), require('chance')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'babel-runtime/helpers/slicedToArray', 'babel-runtime/core-js/get-iterator', 'babel-runtime/helpers/extends', 'babel-runtime/core-js/promise', 'babel-runtime/regenerator', 'babel-runtime/helpers/asyncToGenerator', 'babel-runtime/core-js/object/assign', 'babel-runtime/core-js/set', 'babel-runtime/helpers/classCallCheck', 'babel-runtime/helpers/createClass', 'babel-runtime/core-js/object/keys', 'babel-runtime/helpers/typeof', 'babel-runtime/core-js/object/get-prototype-of', 'babel-runtime/helpers/possibleConstructorReturn', 'babel-runtime/helpers/inherits', 'chance'], factory) : | ||
(factory((global.Factory = global.Factory || {}),global._slicedToArray,global._getIterator,global._extends,global._Promise,global._regeneratorRuntime,global._asyncToGenerator,global._Object$assign,global._Set,global._classCallCheck,global._createClass,global._Object$keys,global._typeof,global._Object$getPrototypeOf,global._possibleConstructorReturn,global._inherits,global.Chance)); | ||
}(this, function (exports,_slicedToArray,_getIterator,_extends,_Promise,_regeneratorRuntime,_asyncToGenerator,_Object$assign,_Set,_classCallCheck,_createClass,_Object$keys,_typeof,_Object$getPrototypeOf,_possibleConstructorReturn,_inherits,Chance) { 'use strict'; | ||
@@ -13,2 +13,3 @@ _slicedToArray = 'default' in _slicedToArray ? _slicedToArray['default'] : _slicedToArray; | ||
_asyncToGenerator = 'default' in _asyncToGenerator ? _asyncToGenerator['default'] : _asyncToGenerator; | ||
_Object$assign = 'default' in _Object$assign ? _Object$assign['default'] : _Object$assign; | ||
_Set = 'default' in _Set ? _Set['default'] : _Set; | ||
@@ -23,3 +24,2 @@ _classCallCheck = 'default' in _classCallCheck ? _classCallCheck['default'] : _classCallCheck; | ||
Chance = 'default' in Chance ? Chance['default'] : Chance; | ||
_Object$assign = 'default' in _Object$assign ? _Object$assign['default'] : _Object$assign; | ||
@@ -822,12 +822,29 @@ /* eslint-disable no-underscore-dangle */ | ||
key: 'define', | ||
value: function define(name, Model, initializer, options) { | ||
value: function define(name, Model, initializer) { | ||
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; | ||
if (this.getFactory(name, false)) { | ||
throw new Error('Factory ' + name + ' already defined'); | ||
} | ||
this.factories[name] = new Factory(Model, initializer, options); | ||
var factory = this.factories[name] = new Factory(Model, initializer, options); | ||
return factory; | ||
} | ||
}, { | ||
key: 'extend', | ||
value: function extend(parent, name, initializer) { | ||
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; | ||
if (this.getFactory(name, false)) { | ||
throw new Error('Factory ' + name + ' already defined'); | ||
} | ||
var parentFactory = this.getFactory(parent, true); | ||
var Model = options.model || parentFactory.Model; | ||
var factory = this.factories[name] = new Factory(Model, _Object$assign({}, parentFactory.initializer, initializer), options); | ||
return factory; | ||
} | ||
}, { | ||
key: 'attrs', | ||
value: function () { | ||
var _ref = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(name, _attrs, buildOptions) { | ||
var _ref = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(name, _attrs) { | ||
var buildOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
return _regeneratorRuntime.wrap(function _callee$(_context) { | ||
@@ -847,3 +864,3 @@ while (1) { | ||
function attrs(_x2, _x3, _x4) { | ||
function attrs(_x4, _x5) { | ||
return _ref.apply(this, arguments); | ||
@@ -880,3 +897,3 @@ } | ||
function build(_x5) { | ||
function build(_x7) { | ||
return _ref2.apply(this, arguments); | ||
@@ -890,5 +907,6 @@ } | ||
value: function () { | ||
var _ref3 = _asyncToGenerator(_regeneratorRuntime.mark(function _callee3(name, attrs, buildOptions) { | ||
var _ref3 = _asyncToGenerator(_regeneratorRuntime.mark(function _callee3(name, attrs) { | ||
var _this3 = this; | ||
var buildOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var adapter; | ||
@@ -914,3 +932,3 @@ return _regeneratorRuntime.wrap(function _callee3$(_context3) { | ||
function create(_x8, _x9, _x10) { | ||
function create(_x10, _x11) { | ||
return _ref3.apply(this, arguments); | ||
@@ -923,3 +941,5 @@ } | ||
key: 'attrsMany', | ||
value: function attrsMany(name, num, attrs, buildOptions) { | ||
value: function attrsMany(name, num, attrs) { | ||
var buildOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; | ||
return this.getFactory(name).attrsMany(num, attrs, buildOptions); | ||
@@ -930,5 +950,6 @@ } | ||
value: function () { | ||
var _ref4 = _asyncToGenerator(_regeneratorRuntime.mark(function _callee4(name, num, attrs, buildOptions) { | ||
var _ref4 = _asyncToGenerator(_regeneratorRuntime.mark(function _callee4(name, num, attrs) { | ||
var _this4 = this; | ||
var buildOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; | ||
var adapter; | ||
@@ -954,3 +975,3 @@ return _regeneratorRuntime.wrap(function _callee4$(_context4) { | ||
function buildMany(_x11, _x12, _x13, _x14) { | ||
function buildMany(_x14, _x15, _x16) { | ||
return _ref4.apply(this, arguments); | ||
@@ -964,5 +985,6 @@ } | ||
value: function () { | ||
var _ref5 = _asyncToGenerator(_regeneratorRuntime.mark(function _callee5(name, num, attrs, buildOptions) { | ||
var _ref5 = _asyncToGenerator(_regeneratorRuntime.mark(function _callee5(name, num, attrs) { | ||
var _this5 = this; | ||
var buildOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; | ||
var adapter; | ||
@@ -990,3 +1012,3 @@ return _regeneratorRuntime.wrap(function _callee5$(_context5) { | ||
function createMany(_x15, _x16, _x17, _x18) { | ||
function createMany(_x18, _x19, _x20) { | ||
return _ref5.apply(this, arguments); | ||
@@ -993,0 +1015,0 @@ } |
@@ -9,3 +9,3 @@ { | ||
], | ||
"version": "5.0.0", | ||
"version": "5.0.1", | ||
"keywords": [ | ||
@@ -12,0 +12,0 @@ "factory", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
748760
15059