Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chance

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chance - npm Package Compare versions

Comparing version 0.5.1 to 0.5.2

component.json

2

bower.json
{
"name": "chance",
"version": "0.5.1",
"version": "0.5.2",
"main": "chance.js",

@@ -5,0 +5,0 @@ "ignore": ["node_modules"],

@@ -1,2 +0,2 @@

// Chance.js 0.5.1
// Chance.js 0.5.2
// http://chancejs.com

@@ -1030,8 +1030,17 @@ // (c) 2013 Victor Quinn

// Guid
Chance.prototype.guid = function () {
return this.hash({casing: 'upper', length: 8}) + '-' +
this.hash({casing: 'upper', length: 4}) + '-' +
this.hash({casing: 'upper', length: 4}) + '-' +
this.hash({casing: 'upper', length: 4}) + '-' +
this.hash({casing: 'upper', length: 12});
Chance.prototype.guid = function (options) {
options = options || {version: 5};
var guid_pool = "ABCDEF1234567890",
variant_pool = "AB89",
guid = this.string({pool: guid_pool, length: 8}) + '-' +
this.string({pool: guid_pool, length: 4}) + '-' +
// The Version
options.version +
this.string({pool: guid_pool, length: 3}) + '-' +
// The Variant
this.string({pool: variant_pool, length: 1}) +
this.string({pool: guid_pool, length: 3}) + '-' +
this.string({pool: guid_pool, length: 12});
return guid;
};

@@ -1074,3 +1083,3 @@

Chance.prototype.VERSION = "0.5.1";
Chance.prototype.VERSION = "0.5.2";

@@ -1077,0 +1086,0 @@ // Mersenne Twister from https://gist.github.com/banksean/300494

{
"name": "chance",
"main": "./chance.js",
"version": "0.5.1",
"version": "0.5.2",
"description": "Chance - Utility library to generate anything random",

@@ -6,0 +6,0 @@ "homepage": "http://chancejs.com",

@@ -41,3 +41,3 @@ # Chance

<!-- Load Chance -->
<script type="text/javascript" src="components/chance/chance.min.js"></script>
<script type="text/javascript" src="bower_components/chance/chance.min.js"></script>
<script>

@@ -48,15 +48,19 @@ // Use Chance immediately!

### RequireJS
### Component
Chance also includes an AMD define so it can be used with RequireJS.
It can also be used with [Component](http://component.io)
require(['Chance'], function(Chance) {
// Instantiate
var chance = new Chance();
// Then just use it:
var my_random_integer = chance.integer();
});
component install victorquinn/chancejs
then in the HTML of your app:
<!-- Load Chance -->
<script type="text/javascript" src="components/victorquinn-chancejs/chance.js"></script>
<script>
// Use Chance immediately!
alert(chance.string());
</script>
### Node.js

@@ -72,3 +76,15 @@

### RequireJS
Chance also includes an AMD define so it can be used with RequireJS.
require(['Chance'], function(Chance) {
// Instantiate
var chance = new Chance();
// Then just use it:
var my_random_integer = chance.integer();
});
## Author

@@ -85,25 +101,26 @@ ### Victor Quinn

```
project : chancejs
repo age : 4 months
active : 40 days
commits : 215
files : 18
project : chancejs
repo age : 5 months
active : 43 days
commits : 231
files : 19
authors :
167 Victor Quinn 77.7%
11 davmillar 5.1%
11 Tim Petricola 5.1%
5 Michael Cordingley 2.3%
5 Matt Klaber 2.3%
3 qjcg 1.4%
2 dhilipsiva 0.9%
2 Andreas Koeberle 0.9%
2 path411 0.9%
2 Kevin Garnett 0.9%
1 Ryan Tenney 0.5%
1 Doug Lawrence 0.5%
1 Richard Anaya 0.5%
1 Adam Krebs 0.5%
1 leesei 0.5%
180 Victor Quinn 77.9%
11 davmillar 4.8%
11 Tim Petricola 4.8%
5 Michael Cordingley 2.2%
5 Matt Klaber 2.2%
4 Kevin Garnett 1.7%
3 qjcg 1.3%
2 dhilipsiva 0.9%
2 Andreas Koeberle 0.9%
2 path411 0.9%
1 Ryan Tenney 0.4%
1 Doug Lawrence 0.4%
1 Johannes Stein 0.4%
1 Richard Anaya 0.4%
1 Adam Krebs 0.4%
1 leesei 0.4%
```
This project is licensed under the [MIT License](http://en.wikipedia.org/wiki/MIT_License) so feel free to hack away :)

@@ -97,2 +97,37 @@ define(['Chance', 'mocha', 'chai', 'underscore'], function (Chance, mocha, chai, _) {

});
it("returns a proper version 1 guid", function () {
_(1000).times(function () {
guid = chance.guid({version: 1});
expect(guid).to.match(/([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-1([0-9a-fA-F]){3}-([AB89])([0-9a-fA-F]){3}-([0-9a-fA-F]){12}/);
});
});
it("returns a proper version 2 guid", function () {
_(1000).times(function () {
guid = chance.guid({version: 2});
expect(guid).to.match(/([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-2([0-9a-fA-F]){3}-([AB89])([0-9a-fA-F]){3}-([0-9a-fA-F]){12}/);
});
});
it("returns a proper version 3 guid", function () {
_(1000).times(function () {
guid = chance.guid({version: 3});
expect(guid).to.match(/([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-3([0-9a-fA-F]){3}-([AB89])([0-9a-fA-F]){3}-([0-9a-fA-F]){12}/);
});
});
it("returns a proper version 4 guid", function () {
_(1000).times(function () {
guid = chance.guid({version: 4});
expect(guid).to.match(/([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-4([0-9a-fA-F]){3}-([AB89])([0-9a-fA-F]){3}-([0-9a-fA-F]){12}/);
});
});
it("returns a proper version 5 guid", function () {
_(1000).times(function () {
guid = chance.guid({version: 5});
expect(guid).to.match(/([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-5([0-9a-fA-F]){3}-([AB89])([0-9a-fA-F]){3}-([0-9a-fA-F]){12}/);
});
});
});

@@ -99,0 +134,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc