lodash.sample
Advanced tools
Comparing version 3.0.0 to 3.1.0
22
index.js
/** | ||
* lodash 3.0.0 (Custom Build) <https://lodash.com/> | ||
* lodash 3.1.0 (Custom Build) <https://lodash.com/> | ||
* Build: `lodash modern modularize exports="npm" -o ./` | ||
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | ||
* Based on Underscore.js 1.7.0 <http://underscorejs.org/LICENSE> | ||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> | ||
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
@@ -12,3 +12,3 @@ * Available under MIT license <https://lodash.com/license> | ||
toIterable = require('lodash._toiterable'), | ||
shuffle = require('lodash.shuffle'); | ||
toArray = require('lodash.toarray'); | ||
@@ -42,4 +42,16 @@ /* Native method references for those with the same name as other `lodash` methods. */ | ||
} | ||
var result = shuffle(collection); | ||
result.length = nativeMin(n < 0 ? 0 : (+n || 0), result.length); | ||
var index = -1, | ||
result = toArray(collection), | ||
length = result.length, | ||
lastIndex = length - 1; | ||
n = nativeMin(n < 0 ? 0 : (+n || 0), length); | ||
while (++index < n) { | ||
var rand = baseRandom(index, lastIndex), | ||
value = result[rand]; | ||
result[rand] = result[index]; | ||
result[index] = value; | ||
} | ||
result.length = n; | ||
return result; | ||
@@ -46,0 +58,0 @@ } |
Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | ||
Based on Underscore.js 1.7.0, copyright 2009-2015 Jeremy Ashkenas, | ||
Based on Underscore.js, copyright 2009-2015 Jeremy Ashkenas, | ||
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/> | ||
@@ -4,0 +4,0 @@ |
{ | ||
"name": "lodash.sample", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "The modern build of lodash’s `_.sample` as a module.", | ||
@@ -23,4 +23,5 @@ "homepage": "https://lodash.com/", | ||
"lodash._toiterable": "^3.0.0", | ||
"lodash.shuffle": "^3.0.0" | ||
"lodash.toarray": "^3.0.0", | ||
"lodash.values": "^3.0.0" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# lodash.sample v3.0.0 | ||
# lodash.sample v3.1.0 | ||
@@ -20,2 +20,2 @@ The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.sample` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. | ||
See the [documentation](https://lodash.com/docs#sample) or [package source](https://github.com/lodash/lodash/blob/3.0.0-npm-packages/lodash.sample) for more details. | ||
See the [documentation](https://lodash.com/docs#sample) or [package source](https://github.com/lodash/lodash/blob/3.1.0-npm-packages/lodash.sample) for more details. |
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
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
4739
53
5
+ Addedlodash.toarray@^3.0.0
+ Addedlodash.values@^3.0.0
+ Addedlodash._arraycopy@3.0.0(transitive)
+ Addedlodash.toarray@3.0.2(transitive)
+ Addedlodash.values@3.0.0(transitive)
- Removedlodash.shuffle@^3.0.0
- Removedlodash.shuffle@3.1.0(transitive)