@xtia/alea-rc 0.0.3 → 0.0.4

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 CHANGED
@@ -7,8 +7,8 @@ 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
11
- * Ranged int, array shuffling, dice roll, weighted sampling, phrase generation, uuid, bytes and many more
10
+ * ~2.3kb minified core
11
+ * Ranged int, array shuffling, dice roll, weighted sampling, phrase generation, UUID, bytes and many more
12
12
 
13
13
  ## Brief:
14
14
 
package/browser.js CHANGED
@@ -1,3 +1,3 @@
1
- import { createAleaFromByteSource } from "./internal/factories";
1
+ import { createAleaFromByteSource } from "./internal/factories.js";
2
2
  export * from "./common";
3
3
  export const cryptoAlea = createAleaFromByteSource(arr => globalThis.crypto.getRandomValues(arr));
package/common.d.ts CHANGED
@@ -1,5 +1,8 @@
1
- import { Alea } from "./internal/alea";
1
+ import { Alea } from "./internal/alea.js";
2
2
  export type { Alea };
3
- export { createAleaFromByteSource, createAleaFromSeed, createAleaFromFunc, } from "./internal/factories";
4
- export { charsets } from "./internal/charsets";
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
+ */
5
8
  export declare const alea: Alea;
package/common.js CHANGED
@@ -1,4 +1,7 @@
1
- import { Alea } from "./internal/alea";
2
- export { createAleaFromByteSource, createAleaFromSeed, createAleaFromFunc, } from "./internal/factories";
3
- export { charsets } from "./internal/charsets";
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
+ */
4
7
  export const alea = new Alea(Math.random);
@@ -1,4 +1,4 @@
1
- import { Alea } from "./alea";
1
+ import { Alea } from "./alea.js";
2
2
  /**
3
3
  * Create an Alea instance using a byte generator, such as `crypto`,
4
4
  * as a RNG source
@@ -1,5 +1,5 @@
1
- import { mulberry32 } from "../prng";
2
- import { Alea } from "./alea";
1
+ import { mulberry32 } from "../prng/mulberry32.js";
2
+ import { Alea } from "./alea.js";
3
3
  /**
4
4
  * Create an Alea instance using a byte generator, such as `crypto`,
5
5
  * as a RNG source
package/node.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createAleaFromByteSource } from "./internal/factories";
1
+ import { createAleaFromByteSource } from "./internal/factories.js";
2
2
  import { randomBytes } from 'node:crypto';
3
3
  export * from "./common";
4
4
  export const cryptoAlea = createAleaFromByteSource(arr => {
package/other.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { Alea } from "./internal/alea";
1
+ import { Alea } from "./internal/alea.js";
2
2
  export * from "./common";
3
3
  /**
4
- * An Alea instance that uses the local environment's `crypto` provider
4
+ * An Alea instance that uses the runtime environment's `crypto` provider as a source
5
5
  */
6
6
  export declare const cryptoAlea: Alea;
package/other.js CHANGED
@@ -1,7 +1,7 @@
1
- import { Alea } from "./internal/alea";
1
+ import { Alea } from "./internal/alea.js";
2
2
  export * from "./common";
3
3
  /**
4
- * An Alea instance that uses the local environment's `crypto` provider
4
+ * An Alea instance that uses the runtime environment's `crypto` provider as a source
5
5
  */
6
6
  export const cryptoAlea = new Alea(() => {
7
7
  throw new Error("cryptoAlea is not available in this environment. Consider using createAleaFromByteSource() with your environment's crypto API.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xtia/alea-rc",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "RNG utilities",
5
5
  "repository": {
6
6
  "url": "https://github.com/tiadrop/alea",
package/prng/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { mulberry32 } from "./mulberry32";
2
- export { sfc32 } from "./sfc32";
3
- export { xoshiro128pp } from "./xoshiro128pp";
1
+ export { mulberry32 } from "./mulberry32.js";
2
+ export { sfc32 } from "./sfc32.js";
3
+ export { xoshiro128pp } from "./xoshiro128pp.js";
package/prng/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export { mulberry32 } from "./mulberry32";
2
- export { sfc32 } from "./sfc32";
3
- export { xoshiro128pp } from "./xoshiro128pp";
1
+ export { mulberry32 } from "./mulberry32.js";
2
+ export { sfc32 } from "./sfc32.js";
3
+ export { xoshiro128pp } from "./xoshiro128pp.js";
@@ -1,4 +1,4 @@
1
- import { Alea } from "../internal/alea";
1
+ import { Alea } from "../internal/alea.js";
2
2
  /**
3
3
  * Create an Alea instance using a Mulberry32 source
4
4
  *
@@ -1,5 +1,5 @@
1
- import { Alea } from "../internal/alea";
2
- import { murmur3_32 } from "../internal/util";
1
+ import { Alea } from "../internal/alea.js";
2
+ import { murmur3_32 } from "../internal/util.js";
3
3
  /**
4
4
  * Create an Alea instance using a Mulberry32 source
5
5
  *
package/prng/sfc32.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Alea } from "../internal/alea";
1
+ import { Alea } from "../internal/alea.js";
2
2
  /**
3
3
  * Create an Alea instance using a Small Fast Counter (SFC32) source
4
4
  *
package/prng/sfc32.js CHANGED
@@ -1,5 +1,5 @@
1
- import { Alea } from "../internal/alea";
2
- import { murmur3_32 } from "../internal/util";
1
+ import { Alea } from "../internal/alea.js";
2
+ import { murmur3_32 } from "../internal/util.js";
3
3
  /**
4
4
  * Create an Alea instance using a Small Fast Counter (SFC32) source
5
5
  *
@@ -1,4 +1,4 @@
1
- import { Alea } from "../internal/alea";
1
+ import { Alea } from "../internal/alea.js";
2
2
  /**
3
3
  * Create an Alea instance using a Xoshiro128++ source
4
4
  *
@@ -1,5 +1,5 @@
1
- import { Alea } from "../internal/alea";
2
- import { murmur3_32 } from "../internal/util";
1
+ import { Alea } from "../internal/alea.js";
2
+ import { murmur3_32 } from "../internal/util.js";
3
3
  function rotl(x, k) {
4
4
  return (x << k) | (x >>> (32 - k));
5
5
  }