Comparing version 0.5.7 to 0.5.8
{ | ||
"name": "chance", | ||
"version": "0.5.7", | ||
"version": "0.5.8", | ||
"main": "chance.js", | ||
@@ -5,0 +5,0 @@ "ignore": ["node_modules"], |
@@ -5,3 +5,3 @@ { | ||
"description": "Minimalist generator of random strings, numbers, etc.", | ||
"version": "0.5.7", | ||
"version": "0.5.8", | ||
"keywords": ["chance", "random", "generator", "test"], | ||
@@ -8,0 +8,0 @@ "main": "chance.js", |
{ | ||
"name": "chance", | ||
"main": "./chance.js", | ||
"version": "0.5.7", | ||
"version": "0.5.8", | ||
"description": "Chance - Utility library to generate anything random", | ||
@@ -6,0 +6,0 @@ "homepage": "http://chancejs.com", |
@@ -111,11 +111,11 @@ # Chance | ||
active : 77 days | ||
commits : 302 | ||
commits : 306 | ||
files : 21 | ||
authors : | ||
226 Victor Quinn 74.8% | ||
13 Tim Petricola 4.3% | ||
230 Victor Quinn 75.2% | ||
13 Tim Petricola 4.2% | ||
11 davmillar 3.6% | ||
5 Michael Cordingley 1.7% | ||
5 Alex DiLiberto 1.7% | ||
5 Matt Klaber 1.7% | ||
5 Michael Cordingley 1.6% | ||
5 Alex DiLiberto 1.6% | ||
5 Matt Klaber 1.6% | ||
4 Kevin Garnett 1.3% | ||
@@ -122,0 +122,0 @@ 3 Alexandr Lozovyuk 1.0% |
@@ -93,2 +93,25 @@ define(['Chance', 'mocha', 'chai', 'underscore'], function (Chance, mocha, chai, _) { | ||
describe("currency", function () { | ||
var currency, chance = new Chance(); | ||
it("returns a currency", function () { | ||
_(1000).times(function () { | ||
currency = chance.currency(); | ||
expect(currency).to.be.an("object"); | ||
expect(currency.code).to.exist; | ||
expect(currency.code.length).to.equal(3); | ||
expect(currency.name).to.be.ok; | ||
}); | ||
}); | ||
it("returns a currency pair", function () { | ||
_(1000).times(function () { | ||
var currency_pair = chance.currency_pair(); | ||
expect(currency_pair).to.be.an("array"); | ||
expect(currency_pair.length).to.equal(2); | ||
expect(currency_pair[0].code).to.not.equal(currency_pair[1].code); | ||
}); | ||
}); | ||
}); | ||
describe("Expiration", function () { | ||
@@ -95,0 +118,0 @@ it("exp() looks correct", function () { |
@@ -110,2 +110,24 @@ define(['Chance', 'mocha', 'chai', 'underscore'], function (Chance, mocha, chai, _) { | ||
}); | ||
it("will take a custom comparator for comparing complex objects", function () { | ||
_(1000).times(function () { | ||
var arr = chance.unique(chance.currency, 25, { | ||
comparator: function(arr, val) { | ||
// If this is the first element, we know it doesn't exist | ||
if (arr.length === 0) { | ||
return false; | ||
} | ||
return arr.reduce(function(acc, item) { | ||
// If a match has been found, short circuit check and just return | ||
if (acc) { | ||
return acc; | ||
} | ||
return item.name === val.name; | ||
}, false); | ||
} | ||
}); | ||
expect(_.uniq(arr).length).to.equal(25); | ||
}); | ||
}); | ||
}); | ||
@@ -112,0 +134,0 @@ |
Sorry, the diff of this file is too big to display
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
140433
2853