lodash.product
Advanced tools
Comparing version 17.8.19 to 17.12.17
@@ -1,24 +0,1 @@ | ||
(function(_) { | ||
_.mixin({product: function() { | ||
var collections = _.map(arguments, _.values); | ||
var product = []; | ||
(function f(tuple) { | ||
if (tuple.length < collections.length) { | ||
_.forEach(collections[tuple.length], function(value) { | ||
f(_.concat(tuple, [value])); | ||
}); | ||
} else { | ||
product.push(tuple); | ||
} | ||
})([]); | ||
return product; | ||
}}); | ||
})((function() { | ||
if (typeof module !== 'undefined' && typeof exports !== 'undefined' && this === exports) { | ||
return require('lodash'); | ||
} else { | ||
return _; | ||
} | ||
}).call(this)); | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("lodash")):"function"==typeof define&&define.amd?define(["lodash"],t):t(n._)}(this,function(n){"use strict";(n=n&&n.hasOwnProperty("default")?n.default:n).mixin({product:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var o=[];return function(n){var t=function(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];return n.call.apply(n,[this,t].concat(e))};return t}(function(e,f){f.length<t.length?n.forEach(t[f.length],function(t){e(n.concat(f,[t]))}):o.push(f)})([]),o}})}); |
{ | ||
"name": "lodash.product", | ||
"version": "17.8.19", | ||
"description": "Calculates the Cartesian product between multiple collections.", | ||
"main": "lodash.product.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/SeregPie/lodash.product.git" | ||
}, | ||
"author": "Sergej Sintschilin", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/SeregPie/lodash.product/issues" | ||
}, | ||
"homepage": "https://github.com/SeregPie/lodash.product#readme", | ||
"dependencies": { | ||
"lodash": "latest" | ||
} | ||
"name": "lodash.product", | ||
"version": "17.12.17", | ||
"description": "Calculates the Cartesian product between multiple collections.", | ||
"main": "lodash.product.js", | ||
"scripts": { | ||
"build": "rollup -c", | ||
"prepublishOnly": "npm run build" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/SeregPie/lodash.product.git" | ||
}, | ||
"keywords": [ | ||
"array", | ||
"cartesian", | ||
"collection", | ||
"combinatorics", | ||
"lodash", | ||
"mixin", | ||
"product" | ||
], | ||
"author": "Sergej Sintschilin", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/SeregPie/lodash.product/issues" | ||
}, | ||
"homepage": "https://github.com/SeregPie/lodash.product#readme", | ||
"dependencies": { | ||
"lodash": "^4.17.4" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^4.13.1", | ||
"rollup": "^0.52.2", | ||
"rollup-plugin-buble": "^0.18.0", | ||
"rollup-plugin-uglify": "^2.0.1" | ||
} | ||
} |
@@ -19,3 +19,3 @@ # lodash.product | ||
Install the [package](https://www.npmjs.com/package/lodash.product) via npm. | ||
### npm | ||
@@ -28,13 +28,22 @@ ```sh | ||
Import the module into your Node.js project. | ||
### ES module | ||
```javascript | ||
```js | ||
import _ from 'lodash'; | ||
import 'lodash.product'; | ||
``` | ||
### Node | ||
```js | ||
const _ = require('lodash'); | ||
require('lodash.product'); | ||
``` | ||
--- | ||
### browser | ||
Include the code in your page via a CDN. | ||
```html | ||
@@ -49,11 +58,15 @@ | ||
```javascript | ||
```js | ||
let product = _.product([false, true], ['a', 'b', 'c'], [{}]); | ||
// => [[false, 'a', {}], [false, 'b', {}], [false, 'c', {}], [true, 'a', {}], [true, 'b', {}], [true, 'c', {}]] | ||
``` | ||
```javascript | ||
```js | ||
let array = [1, 2, 3]; | ||
let product = _.product(array, array); | ||
// => [[1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3]] | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
70
3515
4
4
3
1
Updatedlodash@^4.17.4