Comparing version 0.7.1 to 0.7.2
@@ -14,5 +14,5 @@ #!/usr/bin/env node | ||
// Invoke the generator on our Chance instance and print the result. | ||
process.stdout.write(chance[generator](options) + '\n'); | ||
process.stdout.write(chance[generator](options)); | ||
} else { | ||
process.stderr.write('Unknown generator "' + generator + '"\n'); | ||
process.stderr.write('Unknown generator "' + generator + '"'); | ||
} |
{ | ||
"name": "chance", | ||
"version": "0.7.1", | ||
"version": "0.7.2", | ||
"main": "chance.js", | ||
@@ -20,8 +20,7 @@ "ignore": [ | ||
"devDependencies": { | ||
"mocha": "1.18.0", | ||
"chai": "~1.9.0", | ||
"requirejs": "~2.1.11", | ||
"lodash": "~2.4.1", | ||
"phone_number_js": "~1.0.0" | ||
"chai": "~1.10.0", | ||
"mocha": "~2.1.0", | ||
"phone_number_js": "~1.0.0", | ||
"requirejs": "~2.1.15" | ||
} | ||
} |
@@ -5,3 +5,3 @@ { | ||
"description": "Minimalist generator of random strings, numbers, etc.", | ||
"version": "0.7.1", | ||
"version": "0.7.2", | ||
"keywords": ["chance", "random", "generator", "test"], | ||
@@ -8,0 +8,0 @@ "main": "chance.js", |
@@ -7,5 +7,5 @@ module.exports = function (grunt) { | ||
options: { | ||
// Enforcing | ||
curly: true, | ||
eqeqeq: true, | ||
expr: true, | ||
immed: true, | ||
@@ -16,13 +16,23 @@ indent: 4, | ||
noarg: true, | ||
sub: true, | ||
trailing: true, | ||
undef: true, | ||
unused: true, | ||
// Relaxing | ||
boss: true, | ||
eqnull: true, | ||
expr: true, | ||
sub: true, | ||
// Environments | ||
browser: true, | ||
white: false | ||
mocha: true, | ||
node: true, | ||
// Custom Globals | ||
globals: { | ||
define: false, | ||
mochaPhantomJS: false, | ||
chance: true | ||
} | ||
}, | ||
globals: { | ||
exports: true, | ||
module: false | ||
}, | ||
all: js_files | ||
@@ -35,2 +45,6 @@ }, | ||
my_target: { | ||
options: { | ||
sourceMap: true, | ||
sourceMapName: 'chance.min.js.map' | ||
}, | ||
files: { | ||
@@ -37,0 +51,0 @@ 'chance.min.js': ['chance.js'] |
{ | ||
"name": "chance", | ||
"main": "./chance.js", | ||
"version": "0.7.1", | ||
"version": "0.7.2", | ||
"description": "Chance - Utility library to generate anything random", | ||
@@ -23,13 +23,13 @@ "homepage": "http://chancejs.com", | ||
"grunt": "0.4.5", | ||
"grunt-bump": "0.0.11", | ||
"grunt-contrib-jshint": "0.10.0", | ||
"grunt-contrib-uglify": "0.5.0", | ||
"grunt-bump": "0.0.16", | ||
"grunt-contrib-jshint": "^0.11.0", | ||
"grunt-contrib-uglify": "^0.7.0", | ||
"grunt-contrib-watch": "0.6.1", | ||
"grunt-mocha-phantomjs": "0.5.0", | ||
"grunt-shell": "0.7.0", | ||
"grunt-mocha-phantomjs": "^0.6.0", | ||
"line-by-line": "^0.1.3", | ||
"mocha-phantomjs": "3.5.0", | ||
"uglify-js": "1.2.6" | ||
"lodash-cli": "^2.4.2", | ||
"mocha-phantomjs": "^3.5.3" | ||
}, | ||
"scripts": { | ||
"postinstall": "lodash compat -o test/lib/lodash/lodash.build.js", | ||
"test": "./node_modules/mocha-phantomjs/bin/mocha-phantomjs test/runner.html" | ||
@@ -36,0 +36,0 @@ }, |
@@ -6,3 +6,3 @@ require.config({ | ||
'mocha': 'lib/mocha/mocha', | ||
'underscore': 'lib/lodash/dist/lodash', | ||
'underscore': 'lib/lodash/lodash.build.min', | ||
'phoneTest': 'lib/phone_number_js/dist/phoneNumber.min' | ||
@@ -19,3 +19,3 @@ }, | ||
ignoreLeaks: true, | ||
timeout: 5000 // ms | ||
timeout: 8000 // ms | ||
}); | ||
@@ -31,4 +31,3 @@ return this.mocha; | ||
require(['mocha', 'chai'], function (mocha, chai) { | ||
var assert = chai.assert; | ||
require(['mocha', 'chai'], function (mocha) { | ||
require(['test.address', 'test.basic', 'test.finance', 'test.helpers', 'test.misc', 'test.person', 'test.text', 'test.time', 'test.web', 'test.mobile'], function () { | ||
@@ -35,0 +34,0 @@ mocha.reporter('html'); |
@@ -5,8 +5,7 @@ { | ||
"devDependencies": { | ||
"mocha": "1.18.0", | ||
"chai": "~1.9.0", | ||
"requirejs": "~2.1.11", | ||
"lodash": "~2.4.1", | ||
"phone_number_js": "~1.0.0" | ||
"chai": "~1.10.0", | ||
"mocha": "~2.1.0", | ||
"phone_number_js": "~1.0.0", | ||
"requirejs": "~2.1.15" | ||
} | ||
} |
define(['Chance', 'mocha', 'chai', 'underscore', 'phoneTest'], function (Chance, mocha, chai, _, phoneTest) { | ||
var assert = chai.assert, | ||
expect = chai.expect; | ||
var expect = chai.expect; | ||
describe("Address", function () { | ||
var zip, suffix, suffixes, state, address, phone, coordinates, country, chance = new Chance(); | ||
var zip, suffix, suffixes, state, address, country, chance = new Chance(); | ||
@@ -8,0 +7,0 @@ describe("Zip", function () { |
@@ -13,3 +13,3 @@ define(['Chance', 'mocha', 'chai', 'underscore'], function (Chance, mocha, chai, _) { | ||
}); | ||
it("set custom data", function () { | ||
@@ -23,3 +23,3 @@ cData = {lastNames: ["customName", "testLast"]}; | ||
}); | ||
describe("Bool", function () { | ||
@@ -26,0 +26,0 @@ it("returns a random boolean", function () { |
@@ -136,2 +136,12 @@ define(['Chance', 'mocha', 'chai', 'underscore'], function (Chance, mocha, chai, _) { | ||
}); | ||
it("works with weights of 0", function () { | ||
picked = chance.weighted(['a', 'b', 'c'], [1, 0, 1]); | ||
expect(picked).to.be.a('string'); | ||
}); | ||
it("works with negative weights", function () { | ||
picked = chance.weighted(['a', 'b', 'c'], [1, -2, 1]); | ||
expect(picked).to.be.a('string'); | ||
}); | ||
}); | ||
@@ -179,3 +189,3 @@ | ||
_.forEach(positions, function(position, index) { | ||
_.forEach(positions, function(position) { | ||
_.forEach(position, function(item) { | ||
@@ -243,4 +253,9 @@ // This should be around 20% give or take a bit since there are | ||
}); | ||
it("gives an empty array when n is set to 0", function () { | ||
var arr = chance.n(chance.email, 0); | ||
expect(arr).to.be.an('array'); | ||
expect(arr.length).to.equal(0); | ||
}); | ||
}); | ||
describe("pad()", function () { | ||
@@ -247,0 +262,0 @@ it("always returns same number when width same as the length of the number", function () { |
@@ -236,2 +236,3 @@ define(['Chance', 'mocha', 'chai', 'underscore'], function (Chance, mocha, chai, _) { | ||
var chance = new Chance(); | ||
var cnpj; | ||
@@ -238,0 +239,0 @@ it("returns a valid Brazil company ID (CNPJ)", function () { |
@@ -5,3 +5,3 @@ define(['Chance', 'mocha', 'chai', 'underscore'], function (Chance, mocha, chai, _) { | ||
describe("Person", function () { | ||
var age, name, first, last, prefix, suffix, ssn, chance = new Chance(); | ||
var name, first, last, prefix, suffix, ssn, chance = new Chance(); | ||
@@ -179,2 +179,3 @@ describe("age()", function () { | ||
describe("cpf()", function () { | ||
var cpf; | ||
it("returns a random valid taxpayer number for Brazil citizens (CPF)", function () { | ||
@@ -181,0 +182,0 @@ _(1000).times(function () { |
@@ -5,3 +5,3 @@ define(['Chance', 'mocha', 'chai', 'underscore'], function (Chance, mocha, chai, _) { | ||
describe("Time", function () { | ||
var date, hour, minute, time, timestamp, month, year, bounds, chance = new Chance(); | ||
var date, hour, minute, timestamp, month, year, bounds, chance = new Chance(); | ||
@@ -8,0 +8,0 @@ it("date() returns a date", function () { |
Sorry, the diff of this file is not supported yet
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
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
197785
9
3829
1