@pedrouid/iso-random
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -1,3 +0,2 @@ | ||
export declare function randomBytes(length: number): Uint8Array; | ||
export default randomBytes; | ||
export * from './node'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -9,36 +9,7 @@ "use strict"; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.randomBytes = void 0; | ||
const env = __importStar(require("@pedrouid/environment")); | ||
const helpers_1 = require("./helpers"); | ||
function randomBytes(length) { | ||
if (!helpers_1.isValidKeyLength(length)) { | ||
throw new Error(`randomBytes - invalid key length: ${length}`); | ||
} | ||
let result; | ||
if (env.isBrowser()) { | ||
result = helpers_1.browserRandomBytes(length); | ||
} | ||
else if (env.isNode()) { | ||
result = helpers_1.nodeRandomBytes(length); | ||
} | ||
else { | ||
result = helpers_1.fallbackRandomBytes(length); | ||
} | ||
return result; | ||
} | ||
exports.randomBytes = randomBytes; | ||
exports.default = randomBytes; | ||
__exportStar(require("./node"), exports); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@pedrouid/iso-random", | ||
"description": "Isomorphic Library for Random Bytes", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"author": "Pedro Gomes <github.com/pedrouid>", | ||
@@ -17,3 +17,10 @@ "license": "MIT", | ||
], | ||
"main": "dist/cjs/index.js", | ||
"main": "dist/cjs/node/index.js", | ||
"exports": { | ||
".": { | ||
"node": "./node/index.js", | ||
"browser": "./browser/index.js", | ||
"default": "./fallback/index.js" | ||
} | ||
}, | ||
"types": "dist/cjs/index.d.ts", | ||
@@ -20,0 +27,0 @@ "unpkg": "dist/umd/index.min.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
25
548903
1229