@mxfb/tools 0.0.33 → 0.0.35

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/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as Comp from './components/Comp/index.js'
2
2
  import * as absoluteModulo from './utils/agnostic/absolute-modulo/index.js'
3
- import * as arrayRandomPick from './utils/agnostic/array-random-pick/index.js'
3
+ import * as array from './utils/agnostic/array/index.js'
4
4
  import * as assert from './utils/agnostic/assert/index.js'
5
5
  import * as awaitTimeout from './utils/agnostic/await-timeout/index.js'
6
6
  import * as bem from './utils/agnostic/bem/index.js'
@@ -9,7 +9,6 @@ import * as charcodeString from './utils/agnostic/charcode-string/index.js'
9
9
  import * as clamp from './utils/agnostic/clamp/index.js'
10
10
  import * as clientsideHtmlSanitizer from './utils/agnostic/clientside-html-sanitizer/index.js'
11
11
  import * as crossenv from './utils/agnostic/crossenv/index.js'
12
- import * as findDuplicatesInArray from './utils/agnostic/find-duplicates-in-array/index.js'
13
12
  import * as flattenGetters from './utils/agnostic/flatten-getters/index.js'
14
13
  import * as generateHtmlPlaceholders from './utils/agnostic/generate-html-placeholders/index.js'
15
14
  import * as generateNiceColor from './utils/agnostic/generate-nice-color/index.js'
@@ -47,7 +46,7 @@ import * as processExit from './utils/node/process-exit/index.js'
47
46
  import * as readWriteFile from './utils/node/read-write-file/index.js'
48
47
  export { Comp }
49
48
  export { absoluteModulo }
50
- export { arrayRandomPick }
49
+ export { array }
51
50
  export { assert }
52
51
  export { awaitTimeout }
53
52
  export { bem }
@@ -56,7 +55,6 @@ export { charcodeString }
56
55
  export { clamp }
57
56
  export { clientsideHtmlSanitizer }
58
57
  export { crossenv }
59
- export { findDuplicatesInArray }
60
58
  export { flattenGetters }
61
59
  export { generateHtmlPlaceholders }
62
60
  export { generateNiceColor }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mxfb/tools",
3
- "version": "0.0.33",
3
+ "version": "0.0.35",
4
4
  "description": "",
5
5
  "author": "Maxime Fabas",
6
6
  "license": "ISC",
@@ -0,0 +1,7 @@
1
+ type Filler<T = any> = (pos?: number) => T;
2
+ export declare function make<T>(filler: Filler<T>, length: number): T[];
3
+ export declare function findDuplicates<T>(arr: T[], stopAtFirst?: boolean): T[];
4
+ export declare const randomPickErrorSybol: unique symbol;
5
+ export type RandomPickErrorSymbol = typeof randomPickErrorSybol;
6
+ export default function randomPick<T>(arr: T[], exclude?: T[]): T | RandomPickErrorSymbol;
7
+ export {};
@@ -0,0 +1 @@
1
+ function f(e,t){return new Array(t).fill(null).map((r,o)=>e(o))}function s(e,t=!1){let r=new Set,o=new Set;for(let n of e){if(r.has(n)&&t)return[n];r.has(n)&&o.add(n),r.add(n)}return Array.from(o)}var a=Symbol();function i(e,t=[]){let r=[...e].filter(l=>!t.includes(l)),o=r.length;if(o===0)return a;let n=Math.floor(Math.random()*o);return r[n]}export{i as default,s as findDuplicates,f as make,a as randomPickErrorSybol};
@@ -1,7 +1,7 @@
1
- export declare function random(bound1: number): number;
2
- export declare function random(bound1: number, bound2: number | undefined): number;
1
+ export declare function random(bound1?: number): number | undefined;
2
+ export declare function random(bound1: number, bound2: number | undefined): number | undefined;
3
3
  export default random;
4
- export declare function randomInt(bound1?: number, bound2?: number): number;
4
+ export declare function randomInt(...args: Parameters<typeof random>): number | undefined;
5
5
  export declare const hexChars: string[];
6
6
  export declare function randomHexChar(): string;
7
7
  export declare function randomHash(length?: number): string;
@@ -1 +1 @@
1
- function o(n=1,r){let t=r===void 0?0:n,e=r===void 0?n:r;if(t===e||t>e)return NaN;let u=e-t;return Math.random()*u+t}var c=o;function f(n=1,r){let t=o(n,r);return Math.floor(t)}var a=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function m(){let n=Math.floor(Math.random()*16);return a[n]}function d(n=4){return new Array(n).fill(null).map(m).join("")}function i(n,r="-"){return n.map(d).join(r)}function s(){return i([8,4,4,4,12])}export{c as default,a as hexChars,o as random,d as randomHash,i as randomHashPattern,m as randomHexChar,f as randomInt,s as randomUUID};
1
+ function o(n=1,r){let e=r===void 0?0:n,t=r===void 0?n:r;if(e===t||e>t)return;let u=t-e;return Math.random()*u+e}var f=o;function c(...n){let r=o(...n);return r!==void 0?Math.floor(r):void 0}var d=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function a(){let n=Math.floor(Math.random()*16);return d[n]}function i(n=4){return new Array(n).fill(null).map(a).join("")}function m(n,r="-"){return n.map(i).join(r)}function s(){return m([8,4,4,4,12])}export{f as default,d as hexChars,o as random,i as randomHash,m as randomHashPattern,a as randomHexChar,c as randomInt,s as randomUUID};
@@ -1,3 +0,0 @@
1
- export declare const errorSybol: unique symbol;
2
- export type ErrorSymbol = typeof errorSybol;
3
- export default function arrayRandomPick<T>(arr: T[], exclude?: T[]): T | ErrorSymbol;
@@ -1 +0,0 @@
1
- var f=Symbol();function a(t,e=[]){let r=[...t].filter(l=>!e.includes(l)),o=r.length;if(o===0)return f;let n=Math.floor(Math.random()*o);return r[n]}export{a as default,f as errorSybol};
@@ -1 +0,0 @@
1
- export default function findDuplicatesInArray<T>(arr: T[], stopAtFirst?: boolean): T[];
@@ -1 +0,0 @@
1
- function o(a,r=!1){let n=new Set,t=new Set;for(let e of a){if(n.has(e)&&r)return[e];n.has(e)&&t.add(e),n.add(e)}return Array.from(t)}export{o as default};