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.1.0 to 1.2.0

dist/factoryMate/generators/ProvidedValueGenerator.d.ts

4

dist/factoryMate/generators/Generator.d.ts

@@ -1,3 +0,3 @@

export interface Generator {
nextValue(): number;
export interface Generator<T> {
nextValue(): T;
}
import { Generator } from './Generator';
export declare class NumberGenerator implements Generator {
export declare class NumberGenerator implements Generator<number> {
private currentValue;

@@ -4,0 +4,0 @@ private increment;

export * from './factoryMate/FactoryMateAware';
export * from './factoryMate/FactoryMate';
export * from './factoryMate/generators/NumberGenerator';
export * from './factoryMate/generators/ProvidedValueGenerator';

@@ -9,1 +9,2 @@ "use strict";

__export(require("./factoryMate/generators/NumberGenerator"));
__export(require("./factoryMate/generators/ProvidedValueGenerator"));
{
"name": "factory-mate",
"version": "1.1.0",
"version": "1.2.0",
"description": "TypeScript library for building domain objects",

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

"testSingleRun": "karma start --single-run",
"package": "tsc && npm pack"
"package": "rm -rf ./dist && tsc && npm pack",
"report-coverage": "cat ./coverage/lcov/lcov.info | coveralls"
},

@@ -33,2 +35,3 @@ "author": "Ryan Waskiewicz",

"base64-js": "^1.0.2",
"coveralls": "^2.13.1",
"ieee754": "^1.1.4",

@@ -35,0 +38,0 @@ "isarray": "^1.0.0",

# FactoryMate
[![Build Status](https://travis-ci.org/rwaskiewicz/factory-mate.svg?branch=develop)](https://travis-ci.org/rwaskiewicz/factory-mate)
[![npm version](https://badge.fury.io/js/factory-mate.svg)](https://badge.fury.io/js/factory-mate)
[![Coverage Status](https://coveralls.io/repos/github/rwaskiewicz/factory-mate/badge.svg?branch=develop)](https://coveralls.io/github/rwaskiewicz/factory-mate?branch=develop)

@@ -88,3 +89,3 @@ FactoryMate is a TypeScript-based fixture library for instantiating domain objects for testing purposes, inspired by

### Sequence Generation
FactoryMate supports numerical sequence generation via the ```NumberGenerator``` class. This can be helpful for the purposes of generating ID values for domain objects to better represent real world scenarios (e.g. keys in from a datastore)
FactoryMate supports infinite, numerical sequence generation via the ```NumberGenerator``` class. This can be helpful for the purposes of generating ID values for domain objects to better represent real world scenarios (e.g. keys in a data store)

@@ -135,2 +136,14 @@ In order to add sequential generation support to an entity, it can be imported into it's factory as such:

### ProvidedValueGenerator
FactoryMate also supports finite sequence generation by means of the `ProvidedValueGenerator` class. `ProvidedValueGenerator` is capable of returning values from an `Array` of numbers, strings, objects, etc. that was provided to the class upon instantiation:
``` typescript
const providedValueGenerator = new ProvidedValueGenerator(['up', 'left', 'right']);
const firstValue = providedValueGenerator.nextValue(); // 'up'
const secondValue = providedValueGenerator.nextValue(); // 'left'
const thirdValue = providedValueGenerator.nextValue(); // 'right'
const fourthValue = providedValueGenerator.nextValue(); // Error: 'Out of bounds!'
```
## Example

@@ -137,0 +150,0 @@ An example project using FactoryMate can be found here [FactoryMateConsumer](https://github.com/rwaskiewicz/factory-mate-consumer)

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