Skip to content

Commit 7a9be07

Browse files
committed
Merge branch 'master' of github.com:alizain/ulid
2 parents 324772c + 0bb2431 commit 7a9be07

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ From the community!
8181
| [PowerShell](https://github.com/PetterBomban/posh-ulid) | [PetterBomban](https://github.com/PetterBomban) |
8282
| [Python](https://github.com/mdipierro/ulid) | [mdipierro](https://github.com/mdipierro) |
8383
| [Python](https://github.com/ahawker/ulid) | [ahawker](https://github.com/ahawker) ||
84+
| [Python](https://github.com/mdomke/python-ulid) | [mdomke](https://github.com/mdomke) ||
8485
| [Ruby](https://github.com/rafaelsales/ulid) | [rafaelsales](https://github.com/rafaelsales) |
8586
| [Rust](https://github.com/mmacedoeu/rulid.rs) | [mmacedoeu](https://github.com/mmacedoeu/rulid.rs) ||
8687
| [Rust](https://github.com/dylanhart/ulid-rs) | [dylanhart](https://github.com/dylanhart) ||

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,18 @@ function factory(prng) {
8181

8282
/* istanbul ignore next */
8383
function _prng(root) {
84+
var crypto = root && (root.crypto || root.msCrypto)
8485

85-
if (root) {
86+
if (crypto) {
8687
try {
87-
var crypto = root.crypto || root.msCrypto
8888
return function() {
8989
return crypto.getRandomValues(new Uint16Array(1))[0] / 0xFFFF
9090
}
9191
}
9292
catch (e) {}
9393
} else {
9494
try {
95-
var crypto = require("crypto")
95+
crypto = require("crypto")
9696
return function() {
9797
return crypto.randomBytes(2).readUInt16LE() / 0xFFFF
9898
}

0 commit comments

Comments
 (0)