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

factory-mate

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

factory-mate - npm Package Compare versions

Comparing version 1.3.0 to 1.3.1

dist/factoryMate/FactoryStamp.d.ts

13

dist/factoryMate/FactoryMate.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var FactoryStamp_1 = require("./FactoryStamp");
var FactoryMate = (function () {

@@ -10,7 +11,3 @@ function FactoryMate() {

FactoryMate.defineWithName = function (cns, alias, initFunction) {
FactoryMate.definedConstructors.push({
classAlias: alias,
classConstructor: cns,
initializationFunction: initFunction
});
FactoryMate.definedConstructors.push(new FactoryStamp_1.FactoryStamp(cns, alias, initFunction));
};

@@ -29,3 +26,3 @@ FactoryMate.build = function (itemName, overrideFn) {

if (numberToBuild < 1) {
numberToBuild = 1;
throw new Error("Number of Items to Build Must Be 1 or Higher. Received " + numberToBuild);
}

@@ -39,3 +36,5 @@ var createdClasses = new Array();

FactoryMate.locateConstructor = function (objectName) {
var clazz = FactoryMate.definedConstructors.find(function (stored) { return stored.classAlias === objectName; });
var clazz = FactoryMate.definedConstructors.find(function (stored) {
return stored.classAlias === objectName;
});
if (clazz === undefined) {

@@ -42,0 +41,0 @@ throw new Error("Class with name " + objectName + " is not registered to FactoryMate.");

{
"name": "factory-mate",
"version": "1.3.0",
"version": "1.3.1",
"description": "TypeScript library for building domain objects",

@@ -5,0 +5,0 @@ "keywords": [

@@ -16,2 +16,5 @@ # FactoryMate

## Example
An example project using FactoryMate can be found here: [FactoryMateConsumer](https://github.com/rwaskiewicz/factory-mate-consumer)
## Usage

@@ -187,6 +190,19 @@

## Example
An example project using FactoryMate can be found here [FactoryMateConsumer](https://github.com/rwaskiewicz/factory-mate-consumer)
## Recipes
### Creating a Random Number Generator
A random number generator can be created by passing a `Math.random()` function call wrapped in an array to the `ProvidedNumberGenerator` class:
```typescript
// Each call to randomNumberGenerator.nextValue() will produce a number between 0 and 9
const randomNumberGenerator = new ProvidedValueGenerator([Math.floor(Math.random() * 10)], true);
FactoryMate.define(GroceryItem, (): GroceryItem => {
const groceryItem = new GroceryItem();
groceryItem.id = randomNumberGenerator.nextValue();
groceryItem.groceryName = 'Chips';
return groceryItem;
});
```
## License
FactoryMate is distributed under the [MIT license](https://opensource.org/licenses/MIT)
FactoryMate is distributed under the [MIT license](https://opensource.org/licenses/MIT)

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