UNPKG
npx
Version:
latest (10.2.2)
10.2.2
10.2.1
10.2.0
10.1.1
10.0.1
9.7.1
9.7.0
9.6.0
9.5.0
9.4.1
9.4.0
9.3.2
9.3.1
9.2.2
9.2.1
9.2.0
9.1.0
9.0.7
9.0.5
9.0.4
9.0.3
9.0.2
9.0.1
9.0.0
8.1.1
8.1.0
8.0.1
8.0.0
7.0.0
6.2.0
6.1.0
6.0.0
5.4.0
5.3.0
5.2.0
5.1.3
5.1.2
5.1.1
5.1.0
5.0.3
5.0.2
5.0.1
5.0.0
4.0.3
4.0.2
4.0.1
4.0.0
3.0.0
2.1.0
2.0.1
2.0.0
1.1.1
1.1.0
1.0.2
1.0.1
1.0.0
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0
execute npm package binaries
github.com/npm/npx
npm/npx
npx
/
node_modules
/
crypto-random-string
/
index.js
11 lines
(8 loc)
•
241 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
'use strict'
;
const
crypto =
require
(
'crypto'
);
module
.
exports
=
len
=>
{
if
(!
Number
.
isFinite
(len)) {
throw
new
TypeError
(
'Expected a finite number'
); }
return
crypto.
randomBytes
(
Math
.
ceil
(len /
2
)).
toString
(
'hex'
).
slice
(
0
, len); };