Comparing version
MIT License | ||
Copyright ©2018 John Lamansky | ||
Copyright ©2018–2019 Fr. John Lamansky | ||
@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy |
{ | ||
"name": "pfn", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Possible Function. Wraps what might be a function, with fallback behavior in case it’s not. Perfect for use in functions that accept optional callback arguments.", | ||
@@ -11,3 +11,6 @@ "keywords": [ | ||
], | ||
"author": "John Lamansky", | ||
"author": { | ||
"name": "Fr. John Lamansky", | ||
"url": "lamansky.com" | ||
}, | ||
"license": "MIT", | ||
@@ -17,10 +20,14 @@ "homepage": "https://github.com/lamansky/pfn", | ||
"main": "index.js", | ||
"files": [], | ||
"files": [ | ||
"strict.js" | ||
], | ||
"engines": { | ||
"node": ">=4.0.0" | ||
"node": ">=6.0.0" | ||
}, | ||
"dependencies": {}, | ||
"dependencies": { | ||
"is-nil": "^1.0.1" | ||
}, | ||
"devDependencies": { | ||
"eslint-config-lamansky": "^1.0.0", | ||
"mocha": "^5.0.0" | ||
"eslint-config-lamansky": "^2.0.0", | ||
"mocha": "^6.2.2" | ||
}, | ||
@@ -27,0 +34,0 @@ "scripts": { |
@@ -1,5 +0,3 @@ | ||
# pfn | ||
# Possible Function (pfn) | ||
Possible Function. | ||
Wraps what might be a function, with fallback behavior in case it’s not. Perfect for use in functions that accept optional callback arguments. | ||
@@ -9,3 +7,3 @@ | ||
Requires [Node.js](https://nodejs.org/) 4.0.0 or above. | ||
Requires [Node.js](https://nodejs.org/) 6.0.0 or above. | ||
@@ -18,3 +16,3 @@ ```bash | ||
The module exports a single function. | ||
There are two ways you can import the module: `require('pfn')` or `require('pfn/strict')`. Each exposes a single function with the same signature. The difference is that strict mode will throw an error if `fn` is anything other than a function, `null`, or `undefined`. Normal mode will silently defer to `or` if `fn` is of an unexpected type. | ||
@@ -36,3 +34,3 @@ ### Parameters | ||
`pfn` wraps a value that may or may be a function. If the underlying value is not a function, then `pfn` will execute one of the following fallback behaviors. | ||
`pfn` wraps a value that may or may not be a function. If the underlying value is not a function, then `pfn` will execute one of the following fallback behaviors. | ||
@@ -78,2 +76,4 @@ ### Passthrough Fallback | ||
Don’t use the module’s strict mode (`require('pfn/strict')`) if you want self-fallback behavior, because strict mode will throw an error if the first parameter is anything other than a function, `null`, or `undefined`. | ||
```javascript | ||
@@ -104,2 +104,13 @@ const pfn = require('pfn') | ||
For more projects like this, check out the [xfn](https://github.com/lamansky/xfn) family of modules. | ||
This module is part of the `fn` family of modules. | ||
* [efn](https://github.com/lamansky/efn): Extracted Function | ||
* [ffn](https://github.com/lamansky/ffn): Filtering Function | ||
* [jfn](https://github.com/lamansky/jfn): Joined Function | ||
* [mfn](https://github.com/lamansky/mfn): Memoized Function | ||
* [ofn](https://github.com/lamansky/ofn): Overloaded Function | ||
* [qfn](https://github.com/lamansky/qfn): Qualified Function | ||
* [vfn](https://github.com/lamansky/vfn): Variadic Function | ||
* [wfn](https://github.com/lamansky/wfn): Wrapper Function | ||
* [xfn](https://github.com/lamansky/xfn): Extended Function | ||
* [3fn](https://github.com/lamansky/3fn): Three-Way Comparison Function |
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
6148
31.14%5
25%9
200%112
10.89%1
Infinity%+ Added
+ Added