Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

factory-girl

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

factory-girl - npm Package Compare versions

Comparing version 4.2.1 to 4.2.2

20

index.es6.js

@@ -1023,3 +1023,3 @@ import _slicedToArray from 'babel-runtime/helpers/slicedToArray';

value: function cleanUp() {
var promises = [];
var createdArray = [];
var _iteratorNormalCompletion2 = true;

@@ -1031,8 +1031,5 @@ var _didIteratorError2 = false;

for (var _iterator2 = _getIterator(this.created), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var _step2$value = _slicedToArray(_step2.value, 2);
var c = _step2.value;
var adapter = _step2$value[0];
var model = _step2$value[1];
promises.push(adapter.destroy(model, model.constructor));
createdArray.push(c);
}

@@ -1054,5 +1051,14 @@ } catch (err) {

var promise = createdArray.reduce(function (prev, _ref6) {
var _ref7 = _slicedToArray(_ref6, 2);
var adapter = _ref7[0];
var model = _ref7[1];
return prev.then(function () {
return adapter.destroy(model, model.constructor);
});
}, _Promise.resolve());
this.created.clear();
this.resetSeq();
return _Promise.all(promises);
return promise;
}

@@ -1059,0 +1065,0 @@ }, {

@@ -1029,3 +1029,3 @@ 'use strict';

value: function cleanUp() {
var promises = [];
var createdArray = [];
var _iteratorNormalCompletion2 = true;

@@ -1037,8 +1037,5 @@ var _didIteratorError2 = false;

for (var _iterator2 = _getIterator(this.created), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var _step2$value = _slicedToArray(_step2.value, 2);
var c = _step2.value;
var adapter = _step2$value[0];
var model = _step2$value[1];
promises.push(adapter.destroy(model, model.constructor));
createdArray.push(c);
}

@@ -1060,5 +1057,14 @@ } catch (err) {

var promise = createdArray.reduce(function (prev, _ref6) {
var _ref7 = _slicedToArray(_ref6, 2);
var adapter = _ref7[0];
var model = _ref7[1];
return prev.then(function () {
return adapter.destroy(model, model.constructor);
});
}, _Promise.resolve());
this.created.clear();
this.resetSeq();
return _Promise.all(promises);
return promise;
}

@@ -1065,0 +1071,0 @@ }, {

@@ -1029,3 +1029,3 @@ (function (global, factory) {

value: function cleanUp() {
var promises = [];
var createdArray = [];
var _iteratorNormalCompletion2 = true;

@@ -1037,8 +1037,5 @@ var _didIteratorError2 = false;

for (var _iterator2 = _getIterator(this.created), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var _step2$value = _slicedToArray(_step2.value, 2);
var c = _step2.value;
var adapter = _step2$value[0];
var model = _step2$value[1];
promises.push(adapter.destroy(model, model.constructor));
createdArray.push(c);
}

@@ -1060,5 +1057,14 @@ } catch (err) {

var promise = createdArray.reduce(function (prev, _ref6) {
var _ref7 = _slicedToArray(_ref6, 2);
var adapter = _ref7[0];
var model = _ref7[1];
return prev.then(function () {
return adapter.destroy(model, model.constructor);
});
}, _Promise.resolve());
this.created.clear();
this.resetSeq();
return _Promise.all(promises);
return promise;
}

@@ -1065,0 +1071,0 @@ }, {

@@ -9,3 +9,3 @@ {

],
"version": "4.2.1",
"version": "4.2.2",
"keywords": [

@@ -12,0 +12,0 @@ "factory",

@@ -115,3 +115,3 @@ # factory-girl

Provides a function that is called after the model is built.
The function should return the instance or throw an error. For asynchronous functions, it should return a promise that either resolves with the instance or rejects with the error.
The function should return the instance or a Promise for the instance.

@@ -240,2 +240,21 @@ #### `afterCreate: function(model, attrs, buildOptions)`

### ObjectAdapter
`ObjectAdapter` is a simple adapter that uses `const model = new MyModel()`,
`model.save()` and `model.destroy()`.
```js
factory.setAdapter(new factory.ObjectAdapter());
class MyModel {
save() {
// save the model
},
destroy() {
// destroy the model
}
}
}
factory.define('model', MyModel);
```
## Creating new Factories

@@ -242,0 +261,0 @@

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

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