foreslash 0.3.10 → 0.3.11

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Change Log
2
2
 
3
+ ## Version 0.3.11 - 2026-02-08
4
+
5
+ Added Agent Skills
6
+
7
+ - Feat 🥥 Skill(s) added: `random-pick` `deep-clone-any-object`
8
+ - Feat 🥥 Function(s) added: `randomize`
9
+
10
+ 添加了智能体技能(Agent Skills)
11
+
12
+ - 功能 🥥 添加技能: `random-pick` `deep-clone-any-object`
13
+ - 功能 🥥 添加函数: `randomize`
14
+
3
15
  ## Version 0.3.10 - 2026-02-01
4
16
 
5
17
  - Fix 🥕 Bug fixed: `format` config options `separator` and `decimal` now support empty string input
package/lib/index.cmn.cjs CHANGED
@@ -1797,6 +1797,20 @@ function getRealPFromInitP(initP) {
1797
1797
  return 1 / sum;
1798
1798
  }
1799
1799
 
1800
+ const originRandom = Math.random;
1801
+ function randomize() {
1802
+ Math.random = function random() {
1803
+ const [a, b] = [originRandom(), originRandom()];
1804
+ return Date.now() & 1 ? a : b;
1805
+ };
1806
+ const interval = setInterval(() => {
1807
+ }, 50);
1808
+ return function recoverRandomize() {
1809
+ Math.random = originRandom;
1810
+ clearInterval(interval);
1811
+ };
1812
+ }
1813
+
1800
1814
  const radix32 = '0123456789abcdefghijklmnopqrstuv';
1801
1815
  const base32Chars = 'abcdefghijklmnopqrstuvwxyz234567';
1802
1816
  const base32Crockford = '0123456789abcdefghjkmnpqrstvwxyz';
@@ -3070,6 +3084,7 @@ exports.randomHexString = randomHexString;
3070
3084
  exports.randomInt = randomInt;
3071
3085
  exports.randomIntFloor = randomIntFloor;
3072
3086
  exports.randomString = randomString;
3087
+ exports.randomize = randomize;
3073
3088
  exports.range = range;
3074
3089
  exports.remove = remove;
3075
3090
  exports.retry = retry;
package/lib/index.d.ts CHANGED
@@ -1602,6 +1602,19 @@ declare function randomInt(min: number, max: number): number;
1602
1602
  */
1603
1603
  declare function randomIntFloor(min: number, max: number): number;
1604
1604
 
1605
+ /**
1606
+ * 混淆 `Math.random` 使之难以预测, 但会**严重**影响性能, 且仍然存在被预测的可能性\
1607
+ * 如果想要真随机数, 请使用 Crypto API(Web 环境)或 `crypto` 模块(Node.js 环境)\
1608
+ * 该函数返回一个恢复函数, 用于恢复原始的 `Math.random`
1609
+ * @example
1610
+ * ```js
1611
+ * const recoverRandomize = randomize()
1612
+ * recoverRandomize() // 恢复原始 Math.random
1613
+ * ```
1614
+ * @version 0.3.11
1615
+ */
1616
+ declare function randomize(): () => void;
1617
+
1605
1618
  /**
1606
1619
  * 生成指定长度的随机字符串
1607
1620
  * @param length 字符串的长度
@@ -2775,5 +2788,5 @@ declare function throttle<T extends any[]>(fn: (...args: T) => any, delay: numbe
2775
2788
  reset: () => void;
2776
2789
  };
2777
2790
 
2778
- export { $$Empty, _, acceptableFileName, acceptableFileType, arrayToCSV, base64ToBlob, blobToBase64, camelCase, capitalize, cartesianProduct, caseCamel, caseConvert, caseKebab, casePascal, caseSnake, castArray, chinaNumerals, chunk, clamp, compose, constantCase, csvToArray, csvToObjectList, _curryMore as curry, dataUrlToBlob, debounce, decimalNotation, decodeBase64, dedent, deepClone, deepMerge, defer, deprecate, encodeBase64, fastClone, format, getAcceptableExtByMIME, getAcceptableMIMEByExt, getGlobalThis, getInitP, getTag, indent, isArray, isArrayBuffer, isArrayLike, isBigInt, isBigInt64Array, isBigUint64Array, isBlob, isBoolean, isBuffer, isDataView, isDate, isEmpty, isEven, isFile, isFloat32Array, isFloat64Array, isFormData, isFunction, isInt16Array, isInt32Array, isInt8Array, isInteger, isIterable, isMap, isMergeEmptyPlaceholder, isNil, isNull, isNumber, isObject, isOdd, isPlaceholder, isPlainObject, isPrimitive, isPromise, isPromiseLike, isRegExp, isSet, isString, isSymbol, isTypedArray, isUint16Array, isUint32Array, isUint8Array, isUint8ClampedArray, isUndefined, isWeakMap, isWeakSet, isWrapperBigInt, isWrapperBoolean, isWrapperNumber, isWrapperObject, isWrapperString, isWrapperSymbol, kebabCase, lerp, memo, noop, not, objectListToCSV, omit, parallel, pascalCase, pass, passWith, pick, pipe, randomBase32String, randomChoice, randomDistribution, randomHexString, randomInt, randomIntFloor, randomString, range, remove, retry, romanNumerals, round, roundBank, roundBase, roundCeil, roundFloor, scientificNotation, shuffle, sleep, snakeCase, splitWords, throttle, titleCase, transferNumberToSupUniCode, tryit, ulid, uncapitalize, uuidNil, uuidV4, uuidV7, withResolvers };
2791
+ export { $$Empty, _, acceptableFileName, acceptableFileType, arrayToCSV, base64ToBlob, blobToBase64, camelCase, capitalize, cartesianProduct, caseCamel, caseConvert, caseKebab, casePascal, caseSnake, castArray, chinaNumerals, chunk, clamp, compose, constantCase, csvToArray, csvToObjectList, _curryMore as curry, dataUrlToBlob, debounce, decimalNotation, decodeBase64, dedent, deepClone, deepMerge, defer, deprecate, encodeBase64, fastClone, format, getAcceptableExtByMIME, getAcceptableMIMEByExt, getGlobalThis, getInitP, getTag, indent, isArray, isArrayBuffer, isArrayLike, isBigInt, isBigInt64Array, isBigUint64Array, isBlob, isBoolean, isBuffer, isDataView, isDate, isEmpty, isEven, isFile, isFloat32Array, isFloat64Array, isFormData, isFunction, isInt16Array, isInt32Array, isInt8Array, isInteger, isIterable, isMap, isMergeEmptyPlaceholder, isNil, isNull, isNumber, isObject, isOdd, isPlaceholder, isPlainObject, isPrimitive, isPromise, isPromiseLike, isRegExp, isSet, isString, isSymbol, isTypedArray, isUint16Array, isUint32Array, isUint8Array, isUint8ClampedArray, isUndefined, isWeakMap, isWeakSet, isWrapperBigInt, isWrapperBoolean, isWrapperNumber, isWrapperObject, isWrapperString, isWrapperSymbol, kebabCase, lerp, memo, noop, not, objectListToCSV, omit, parallel, pascalCase, pass, passWith, pick, pipe, randomBase32String, randomChoice, randomDistribution, randomHexString, randomInt, randomIntFloor, randomString, randomize, range, remove, retry, romanNumerals, round, roundBank, roundBase, roundCeil, roundFloor, scientificNotation, shuffle, sleep, snakeCase, splitWords, throttle, titleCase, transferNumberToSupUniCode, tryit, ulid, uncapitalize, uuidNil, uuidV4, uuidV7, withResolvers };
2779
2792
  export type { BaseMargeType, CSVObjectParseOptions, CSVParseOptions, CSVStringifyOptions, CastArray, Chunked, CloneOptions, CustomCloner, IsNegative, IsPositive, IsZero, MergeOption, MergeStrategy, MergeStrategyFunction, MergeType, MergeTypeStrategy, Not, RangeOptions, SourceMergeType, Stringify, TargetMergeType, TypedArray };
package/lib/index.mjs CHANGED
@@ -1795,6 +1795,20 @@ function getRealPFromInitP(initP) {
1795
1795
  return 1 / sum;
1796
1796
  }
1797
1797
 
1798
+ const originRandom = Math.random;
1799
+ function randomize() {
1800
+ Math.random = function random() {
1801
+ const [a, b] = [originRandom(), originRandom()];
1802
+ return Date.now() & 1 ? a : b;
1803
+ };
1804
+ const interval = setInterval(() => {
1805
+ }, 50);
1806
+ return function recoverRandomize() {
1807
+ Math.random = originRandom;
1808
+ clearInterval(interval);
1809
+ };
1810
+ }
1811
+
1798
1812
  const radix32 = '0123456789abcdefghijklmnopqrstuv';
1799
1813
  const base32Chars = 'abcdefghijklmnopqrstuvwxyz234567';
1800
1814
  const base32Crockford = '0123456789abcdefghjkmnpqrstvwxyz';
@@ -2953,4 +2967,4 @@ function throttle(fn, delay, options) {
2953
2967
  return _throttle(fn, delay, Object.assign({ trailing: false, leading: true }, options));
2954
2968
  }
2955
2969
 
2956
- export { $$Empty, _, acceptableFileName, acceptableFileType, arrayToCSV, base64ToBlob, blobToBase64, camelCase, capitalize, cartesianProduct, caseCamel, caseConvert, caseKebab, casePascal, caseSnake, castArray, chinaNumerals, chunk, clamp, compose, constantCase, csvToArray, csvToObjectList, _curryMore as curry, dataUrlToBlob, debounce, decimalNotation, decodeBase64, dedent, deepClone, deepMerge, defer, deprecate, encodeBase64, fastClone, format, getAcceptableExtByMIME, getAcceptableMIMEByExt, getGlobalThis, getInitP, getTag, indent, isArray, isArrayBuffer, isArrayLike, isBigInt, isBigInt64Array, isBigUint64Array, isBlob, isBoolean, isBuffer, isDataView, isDate, isEmpty, isEven, isFile, isFloat32Array, isFloat64Array, isFormData, isFunction, isInt16Array, isInt32Array, isInt8Array, isInteger, isIterable, isMap, isMergeEmptyPlaceholder, isNil, isNull, isNumber, isObject, isOdd, isPlaceholder, isPlainObject, isPrimitive, isPromise, isPromiseLike, isRegExp, isSet, isString, isSymbol, isTypedArray, isUint16Array, isUint32Array, isUint8Array, isUint8ClampedArray, isUndefined, isWeakMap, isWeakSet, isWrapperBigInt, isWrapperBoolean, isWrapperNumber, isWrapperObject, isWrapperString, isWrapperSymbol, kebabCase, lerp, memo, noop, not, objectListToCSV, omit, parallel, pascalCase, pass, passWith, pick, pipe, randomBase32String, randomChoice, randomDistribution, randomHexString, randomInt, randomIntFloor, randomString, range, remove, retry, romanNumerals, round, roundBank, roundBase, roundCeil, roundFloor, scientificNotation, shuffle, sleep, snakeCase, splitWords, throttle, titleCase, transferNumberToSupUniCode, tryit, ulid, uncapitalize, uuidNil, uuidV4, uuidV7, withResolvers };
2970
+ export { $$Empty, _, acceptableFileName, acceptableFileType, arrayToCSV, base64ToBlob, blobToBase64, camelCase, capitalize, cartesianProduct, caseCamel, caseConvert, caseKebab, casePascal, caseSnake, castArray, chinaNumerals, chunk, clamp, compose, constantCase, csvToArray, csvToObjectList, _curryMore as curry, dataUrlToBlob, debounce, decimalNotation, decodeBase64, dedent, deepClone, deepMerge, defer, deprecate, encodeBase64, fastClone, format, getAcceptableExtByMIME, getAcceptableMIMEByExt, getGlobalThis, getInitP, getTag, indent, isArray, isArrayBuffer, isArrayLike, isBigInt, isBigInt64Array, isBigUint64Array, isBlob, isBoolean, isBuffer, isDataView, isDate, isEmpty, isEven, isFile, isFloat32Array, isFloat64Array, isFormData, isFunction, isInt16Array, isInt32Array, isInt8Array, isInteger, isIterable, isMap, isMergeEmptyPlaceholder, isNil, isNull, isNumber, isObject, isOdd, isPlaceholder, isPlainObject, isPrimitive, isPromise, isPromiseLike, isRegExp, isSet, isString, isSymbol, isTypedArray, isUint16Array, isUint32Array, isUint8Array, isUint8ClampedArray, isUndefined, isWeakMap, isWeakSet, isWrapperBigInt, isWrapperBoolean, isWrapperNumber, isWrapperObject, isWrapperString, isWrapperSymbol, kebabCase, lerp, memo, noop, not, objectListToCSV, omit, parallel, pascalCase, pass, passWith, pick, pipe, randomBase32String, randomChoice, randomDistribution, randomHexString, randomInt, randomIntFloor, randomString, randomize, range, remove, retry, romanNumerals, round, roundBank, roundBase, roundCeil, roundFloor, scientificNotation, shuffle, sleep, snakeCase, splitWords, throttle, titleCase, transferNumberToSupUniCode, tryit, ulid, uncapitalize, uuidNil, uuidV4, uuidV7, withResolvers };
package/lib/index.umd.js CHANGED
@@ -1801,6 +1801,20 @@ See the Mulan PSL v2 for more details.
1801
1801
  return 1 / sum;
1802
1802
  }
1803
1803
 
1804
+ const originRandom = Math.random;
1805
+ function randomize() {
1806
+ Math.random = function random() {
1807
+ const [a, b] = [originRandom(), originRandom()];
1808
+ return Date.now() & 1 ? a : b;
1809
+ };
1810
+ const interval = setInterval(() => {
1811
+ }, 50);
1812
+ return function recoverRandomize() {
1813
+ Math.random = originRandom;
1814
+ clearInterval(interval);
1815
+ };
1816
+ }
1817
+
1804
1818
  const radix32 = '0123456789abcdefghijklmnopqrstuv';
1805
1819
  const base32Chars = 'abcdefghijklmnopqrstuvwxyz234567';
1806
1820
  const base32Crockford = '0123456789abcdefghjkmnpqrstvwxyz';
@@ -3074,6 +3088,7 @@ See the Mulan PSL v2 for more details.
3074
3088
  exports.randomInt = randomInt;
3075
3089
  exports.randomIntFloor = randomIntFloor;
3076
3090
  exports.randomString = randomString;
3091
+ exports.randomize = randomize;
3077
3092
  exports.range = range;
3078
3093
  exports.remove = remove;
3079
3094
  exports.retry = retry;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foreslash",
3
- "version": "0.3.10",
3
+ "version": "0.3.11",
4
4
  "description": "Foreslash is a Javascript utilities lib which contains plenty of practical functions.",
5
5
  "author": "moushu",
6
6
  "license": "Mulan PSL v2",
@@ -10,7 +10,7 @@
10
10
  "homepage": "https://github.com/Moushudyx/foreslash#readme",
11
11
  "repository": {
12
12
  "type": "git",
13
- "url": "git://github.com/Moushudyx/foreslash.git"
13
+ "url": "https://github.com/Moushudyx/foreslash.git"
14
14
  },
15
15
  "type": "module",
16
16
  "main": "lib/index.mjs",