@xtia/alea-rc 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/entry/browser.d.ts +2 -0
- package/{browser.js → entry/browser.js} +2 -2
- package/entry/common.d.ts +5 -0
- package/entry/common.js +3 -0
- package/entry/node.d.ts +2 -0
- package/{node.js → entry/node.js} +2 -2
- package/{other.d.ts → entry/other.d.ts} +2 -2
- package/{other.js → entry/other.js} +2 -2
- package/internal/mathalea.d.ts +5 -0
- package/internal/mathalea.js +5 -0
- package/package.json +10 -9
- package/browser.d.ts +0 -2
- package/common.d.ts +0 -8
- package/common.js +0 -7
- package/node.d.ts +0 -2
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ Alea is a utility wrapper for turning random numbers into useful values. Give it
|
|
|
7
7
|
* Fully typed
|
|
8
8
|
* Crypto-safe and seeded algorithms out-of-the-box
|
|
9
9
|
* No dependencies
|
|
10
|
-
* ~2.3kb minified core
|
|
10
|
+
* ~2.3kb minified core (1.04kb gzipped)
|
|
11
11
|
* Ranged int, array shuffling, dice roll, weighted sampling, phrase generation, UUID, bytes and many more
|
|
12
12
|
|
|
13
13
|
## Brief:
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { createAleaFromByteSource } from "
|
|
2
|
-
export * from "./common";
|
|
1
|
+
import { createAleaFromByteSource } from "../internal/factories.js";
|
|
2
|
+
export * from "./common.js";
|
|
3
3
|
export const cryptoAlea = createAleaFromByteSource(arr => globalThis.crypto.getRandomValues(arr));
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Alea } from "../internal/alea.js";
|
|
2
|
+
export type { Alea };
|
|
3
|
+
export { createAleaFromByteSource, createAleaFromSeed, createAleaFromFunc, } from "../internal/factories.js";
|
|
4
|
+
export { charsets } from "../internal/charsets.js";
|
|
5
|
+
export { alea } from "../internal/mathalea.js";
|
package/entry/common.js
ADDED
package/entry/node.d.ts
ADDED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createAleaFromByteSource } from "
|
|
1
|
+
import { createAleaFromByteSource } from "../internal/factories.js";
|
|
2
2
|
import { randomBytes } from 'node:crypto';
|
|
3
|
-
export * from "./common";
|
|
3
|
+
export * from "./common.js";
|
|
4
4
|
export const cryptoAlea = createAleaFromByteSource(arr => {
|
|
5
5
|
randomBytes(arr.length).copy(arr);
|
|
6
6
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xtia/alea-rc",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "RNG utilities",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/tiadrop/alea",
|
|
@@ -11,19 +11,20 @@
|
|
|
11
11
|
"main": "./index.js",
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
14
|
-
"types": "./other.d.ts",
|
|
15
|
-
"browser": "./browser.js",
|
|
16
|
-
"workerd": "./browser.js",
|
|
17
|
-
"deno": "./browser.js",
|
|
18
|
-
"node": "./node.js",
|
|
19
|
-
"bun": "./node.js",
|
|
20
|
-
"default": "./other.js"
|
|
14
|
+
"types": "./entry/other.d.ts",
|
|
15
|
+
"browser": "./entry/browser.js",
|
|
16
|
+
"workerd": "./entry/browser.js",
|
|
17
|
+
"deno": "./entry/browser.js",
|
|
18
|
+
"node": "./entry/node.js",
|
|
19
|
+
"bun": "./entry/node.js",
|
|
20
|
+
"default": "./entry/other.js"
|
|
21
21
|
},
|
|
22
22
|
"./prng": {
|
|
23
23
|
"types": "./prng/index.d.ts",
|
|
24
24
|
"default": "./prng/index.js"
|
|
25
25
|
},
|
|
26
|
-
"./internal/*": null
|
|
26
|
+
"./internal/*": null,
|
|
27
|
+
"./entry/*": null
|
|
27
28
|
},
|
|
28
29
|
"scripts": {
|
|
29
30
|
"prepublishOnly": "cp ../README.md .",
|
package/browser.d.ts
DELETED
package/common.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Alea } from "./internal/alea.js";
|
|
2
|
-
export type { Alea };
|
|
3
|
-
export { createAleaFromByteSource, createAleaFromSeed, createAleaFromFunc, } from "./internal/factories.js";
|
|
4
|
-
export { charsets } from "./internal/charsets.js";
|
|
5
|
-
/**
|
|
6
|
-
* An Alea instance that uses Math.random() as a source
|
|
7
|
-
*/
|
|
8
|
-
export declare const alea: Alea;
|
package/common.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Alea } from "./internal/alea.js";
|
|
2
|
-
export { createAleaFromByteSource, createAleaFromSeed, createAleaFromFunc, } from "./internal/factories.js";
|
|
3
|
-
export { charsets } from "./internal/charsets.js";
|
|
4
|
-
/**
|
|
5
|
-
* An Alea instance that uses Math.random() as a source
|
|
6
|
-
*/
|
|
7
|
-
export const alea = new Alea(Math.random);
|
package/node.d.ts
DELETED