Socket
Socket
Sign inDemoInstall

uuid

Package Overview
Dependencies
Maintainers
3
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uuid - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

index.js

4

HISTORY.md

@@ -0,1 +1,5 @@

# 3.0.1 (2016-11-28)
* split uuid versions into separate files
# 3.0.0 (2016-11-17)

@@ -2,0 +6,0 @@

21

lib/rng-browser.js

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

// Unique ID creation requires a high quality random # generator. In the
// browser this is a little complicated due to unknown quality of Math.random()
// and inconsistent support for the `crypto` API. We do the best we can via
// feature-detection
var rng;

@@ -6,8 +9,7 @@

if (crypto && crypto.getRandomValues) {
// WHATWG crypto-based RNG - http://wiki.whatwg.org/wiki/Crypto
// Moderately fast, high quality
var _rnds8 = new Uint8Array(16);
// WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
var rnds8 = new Uint8Array(16);
rng = function whatwgRNG() {
crypto.getRandomValues(_rnds8);
return _rnds8;
crypto.getRandomValues(rnds8);
return rnds8;
};

@@ -21,10 +23,10 @@ }

// quality.
var _rnds = new Array(16);
var rnds = new Array(16);
rng = function() {
for (var i = 0, r; i < 16; i++) {
if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
_rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
}
return _rnds;
return rnds;
};

@@ -34,2 +36,1 @@ }

module.exports = rng;

@@ -0,4 +1,10 @@

// Unique ID creation requires a high quality random # generator. In node.js
// this is prett straight-forward - we use the crypto API.
var rb = require('crypto').randomBytes;
module.exports = function() {
function rng() {
return rb(16);
};
module.exports = rng;
The MIT License (MIT)
Copyright (c) 2010-2012 Robert Kieffer
Copyright (c) 2010-2016 Robert Kieffer and other contributors

@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy

{
"name": "uuid",
"version": "3.0.0",
"version": "3.0.1",
"description": "RFC4122 (v1 and v4) generator",

@@ -11,3 +11,2 @@ "keywords": [

"license": "MIT",
"main": "./uuid.js",
"bin": {

@@ -14,0 +13,0 @@ "uuid": "./bin/uuid"

@@ -10,5 +10,5 @@ # uuid [![Build Status](https://secure.travis-ci.org/kelektiv/node-uuid.svg?branch=master)](http://travis-ci.org/kelektiv/node-uuid) #

* Cryptographically strong random number generation on supporting platforms
* Small footprint (Want something smaller? [Check this out](https://gist.github.com/982883) out!)
* Small footprint (Want something smaller? [Check this out](https://gist.github.com/982883)!)
## Quickstart - nodejs
## Quickstart - CommonJS (Recommended)

@@ -20,21 +20,27 @@ ```shell

```javascript
const uuid = require('uuid');
// Generate a v1 UUID (time-based)
const uuidV1 = require('uuid/v1');
uuidV1(); // -> '6c84fb90-12c4-11e1-840d-7b25c5ee775a'
// Generate a v4 (random) id
uuid() // -> '110ec58a-a0f2-4ac4-8393-c866d813b8d1'
// Generate a v1 (time-based) id
uuid.v1(); // -> '6c84fb90-12c4-11e1-840d-7b25c5ee775a'
// Generate a v4 UUID (random)
const uuidV4 = require('uuid/v4');
uuidV4(); // -> '110ec58a-a0f2-4ac4-8393-c866d813b8d1'
```
## Quickstart - browser
## Quickstart - Pre-packaged for browsers (Not recommended)
** Not recommende for production or even semi-production use. Use a bundling tool instead (i.e. webpack, browserify, rollup, etc)**
Browser-ready versions of this module are available via [wzrd.in](https://github.com/jfhbrook/wzrd.in).
[wzrd.in](https://github.com/jfhbrook/wzrd.in) will serve up any npm module after performing basic bundling and minification.
```html
<script src="http://wzrd.in/standalone/uuid@latest"></script>
```html
<script src="https://wzrd.in/standalone/uuid@latest"></script>
<script>
uuid.v1(); // -> v1 UUID
uuid.v4(); // -> v4 UUID
</script>
```
(Note: Do not do this in production. Just don't. wzrd.in is a great service, but if you're deploying a "real" service you should be using a packaging tool like browserify or webpack. If you do go this route you would be well advised to link to a specific version instead of `uuid@latest` to avoid having your code break when we roll out breaking changes.)
## API

@@ -84,6 +90,2 @@

uuid.v1(null, arr, 16); // -> [02 a2 ce 90 14 32 11 e1 85 58 0b 48 8e 4f c1 15 02 a3 1c b0 14 32 11 e1 85 58 0b 48 8e 4f c1 15]
// Optionally use uuid.unparse() to get stringify the ids
uuid.unparse(buffer); // -> '02a2ce90-1432-11e1-8558-0b488e4fc115'
uuid.unparse(buffer, 16) // -> '02a31cb0-1432-11e1-8558-0b488e4fc115'
```

@@ -90,0 +92,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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