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

factor-in

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

factor-in - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

19

index.js
var objectAssign = require('object-assign')
module.exports = {
/**
* FactoryFactory
* factorIn
* Take optional actions and return a Factory function
* calling said actions
* that calls said actions
* @param {Object} actions

@@ -12,3 +13,3 @@ * @return {Function}

FactorIn: function (actions) {
factorIn: function (actions) {
if (typeof (actions) !== 'object') return null

@@ -22,3 +23,3 @@ actions = actions || {}

/**
* Factory
* factory
* Return a function that applies it's `actions` to any optional `args`

@@ -30,15 +31,9 @@ * and returns an object.

Factory: function (args) {
factory: function (args) {
args = args || null
return function (actions) {
actions = actions || {}
return objectAssign(
{},
actions,
args
)
return objectAssign({}, actions, args)
}
}
}
{
"name": "factor-in",
"version": "1.0.2",
"description": "Factory functions that return a factory functions that inherit and return objects",
"version": "1.0.3",
"description": "Generate unique factory functions that return objects with inherited object data",
"main": "index.js",
"files": [
"LICENSE",
"index.js",
"README.md"
],
"directories": {

@@ -28,2 +33,5 @@ "test": "test"

},
"bugs": {
"url": "https://github.com/chrisbuttery/factor-in.git"
},
"homepage": "https://github.com/chrisbuttery/factor-in.git",

@@ -30,0 +38,0 @@ "keywords": [

@@ -8,3 +8,4 @@ # factor-in

Factory functions that return a factory functions that inherit and custom objects
Generate unique factory functions that return objects with inherited object data.
Useful for creating custom object data for unit tests.

@@ -20,5 +21,7 @@ ## Install

```js
import { FactorIn as FI, Factory as F } from 'factor-in'
import { factorIn as FI, factory as F } from 'factor-in'
const createFactory = FactorIn({
// Create our base factory function with object data we expect all
// factory functions to inherit from.
const FactorIn = FI ({
foo () {},

@@ -28,3 +31,4 @@ bar () {}

const factory1 = Factory({
// Create a new factory function with unique object data
const UniqueFactory = F ({
baz: 'Baz',

@@ -34,12 +38,5 @@ qux: 'Qux'

const myObject1 = createFactory(factory1)
// To create our custom object we`factor-in` our `UniqueFactory` function.
const myCustomObject = FactorIn(UniqueFactory)
//=> {foo: foo(), bar: bar(), baz: 'Baz', qux: 'Qux'}
const factory2 = Factory({
quux: 'Quux',
corge: 'Corge'
})
const myObject2 = createFactory(factory2)
//=> {foo: foo(), bar: bar(), quux: 'Quux', corge: 'Corge'}
```

@@ -46,0 +43,0 @@

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