@noah-libjs/utils 0.0.51 → 0.0.53
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/dist/es.js +15 -1
- package/dist/lib.js +15 -1
- package/dist/small-fn.d.ts +4 -1
- package/dist/typing.d.ts +5 -2
- package/package.json +2 -2
package/dist/es.js
CHANGED
|
@@ -1757,6 +1757,20 @@ function dyn_cb(cb, g_ctx) {
|
|
|
1757
1757
|
return true;
|
|
1758
1758
|
}
|
|
1759
1759
|
}
|
|
1760
|
+
function safe_evaluate_context(str, g_ctx) {
|
|
1761
|
+
var ret = null;
|
|
1762
|
+
if (typeof str !== 'string') return {
|
|
1763
|
+
is_err: true,
|
|
1764
|
+
data: ret
|
|
1765
|
+
};
|
|
1766
|
+
var is_err = dyn_cb(function (ctx) {
|
|
1767
|
+
eval(str);
|
|
1768
|
+
}, g_ctx);
|
|
1769
|
+
return {
|
|
1770
|
+
is_err: is_err,
|
|
1771
|
+
data: ret
|
|
1772
|
+
};
|
|
1773
|
+
}
|
|
1760
1774
|
function safeExec(fn) {
|
|
1761
1775
|
for (var _len8 = arguments.length, args = new Array(_len8 > 1 ? _len8 - 1 : 0), _key8 = 1; _key8 < _len8; _key8++) {
|
|
1762
1776
|
args[_key8 - 1] = arguments[_key8];
|
|
@@ -2703,4 +2717,4 @@ function load_src(items, node) {
|
|
|
2703
2717
|
var load_src_ = create_load_src();
|
|
2704
2718
|
return load_src_(items, node);
|
|
2705
2719
|
}
|
|
2706
|
-
export { ARG_URS1_KEY, ARG_URS2_KEY, EMPTY_PLACEHOLDER, EventEmitter, MyLog, ROMAN_NUMERALS, TOKEN_KEY, all, alphabetical, _assign as assign, base64ToBinary, base64_to_image, boil, cache_fetch, calc_number, callable, camel, capitalize, chain, charToUTF8, charToUnicode, clone, cloneDeep, cluster, compose, confirm_operation, construct, copyText, counting, create_load_src, crush, dash, dayOf, dayjs_quarter, debounce, defer, diff, diff_between, downloadFile, draw,
|
|
2720
|
+
export { ARG_URS1_KEY, ARG_URS2_KEY, EMPTY_PLACEHOLDER, EventEmitter, MyLog, ROMAN_NUMERALS, TOKEN_KEY, all, alphabetical, _assign as assign, base64ToBinary, base64_to_image, boil, cache_fetch, calc_number, callable, camel, capitalize, chain, charToUTF8, charToUnicode, clone, cloneDeep, cluster, compose, confirm_operation, construct, copyText, counting, create_load_src, crush, dash, dayOf, dayjs_quarter, debounce, defer, diff, diff_between, downloadFile, draw, expect_array, filter_obj_to_url_search, first, flat, fork, formatDate, formatDateTime, formatDateTimeNoSecond, formatTime, gen_encoded_char_svg, get, getDictionaries, getDictionariesEnumerations, getDictionaryLabel, getDictionaryValue, getDualModeOptions, getFilledArray, getFuckTimeInterval, getFutureDate, getMomentObj, getMomentRange, getOptionLabel, getOptionValue, getPresetOptions, getSameOptions, getSearchParamsAll, getSearchParamsValue, getSimpleOptions, get_global, group, guard, hasOwn, identity, image_to_base64, inRange, intersects, invert, isArray, isBoolean, isDate, isEmpty, _isEqual as isEqual, isFloat, isFunction, isInt, isMoment, isNil, isNull, isNumber, isObject, isObjectLike, isPrimitive, isPromise, isString, isSymbol, iterate, keys, last, list, listify, load_src, lowerize, map, mapEntries, mapKeys, mapValues, max, memo, merge, merge_dict, merge_preset_options, min, noop, numberLikeCompare, objectify, omit, optionKey不详, optionKey其他, optionKey否, parallel, partial, partob, pascal, pick, presets_date, proxied, random, randomHex, random_word, range, reduce, replace, replaceOrAppend, retry, safeExec, safeGetFromFuncOrData, safe_async_call, safe_evaluate_context, safe_json_parse, safe_json_parse_arr, safe_json_stringify, safe_number_parse, scrollIntoView, select, series, set, setSearchParamsAll, setSearchParamsValue, shake, shift, shuffle, sift, simple_decrypt, simple_decrypt_str, simple_encrypt, simple_encrypt_str, size, sleep, snake, sort, speculate_on_display, sum, template, text_ellipsis, throttle, title, toFloat, toInt, toString, toggle, trim, tryit as try, tryit, uid, unicodeToChar, unicode_to_UTF8, unique, upperize, uuid, warpBase64Type, zip, zipToObject };
|
package/dist/lib.js
CHANGED
|
@@ -1767,6 +1767,20 @@ function dyn_cb(cb, g_ctx) {
|
|
|
1767
1767
|
return true;
|
|
1768
1768
|
}
|
|
1769
1769
|
}
|
|
1770
|
+
function safe_evaluate_context(str, g_ctx) {
|
|
1771
|
+
var ret = null;
|
|
1772
|
+
if (typeof str !== 'string') return {
|
|
1773
|
+
is_err: true,
|
|
1774
|
+
data: ret
|
|
1775
|
+
};
|
|
1776
|
+
var is_err = dyn_cb(function (ctx) {
|
|
1777
|
+
eval(str);
|
|
1778
|
+
}, g_ctx);
|
|
1779
|
+
return {
|
|
1780
|
+
is_err: is_err,
|
|
1781
|
+
data: ret
|
|
1782
|
+
};
|
|
1783
|
+
}
|
|
1770
1784
|
function safeExec(fn) {
|
|
1771
1785
|
for (var _len8 = arguments.length, args = new Array(_len8 > 1 ? _len8 - 1 : 0), _key8 = 1; _key8 < _len8; _key8++) {
|
|
1772
1786
|
args[_key8 - 1] = arguments[_key8];
|
|
@@ -2759,7 +2773,6 @@ exports.diff = diff;
|
|
|
2759
2773
|
exports.diff_between = diff_between;
|
|
2760
2774
|
exports.downloadFile = downloadFile;
|
|
2761
2775
|
exports.draw = draw;
|
|
2762
|
-
exports.dyn_cb = dyn_cb;
|
|
2763
2776
|
exports.expect_array = expect_array;
|
|
2764
2777
|
exports.filter_obj_to_url_search = filter_obj_to_url_search;
|
|
2765
2778
|
exports.first = first;
|
|
@@ -2857,6 +2870,7 @@ exports.retry = retry;
|
|
|
2857
2870
|
exports.safeExec = safeExec;
|
|
2858
2871
|
exports.safeGetFromFuncOrData = safeGetFromFuncOrData;
|
|
2859
2872
|
exports.safe_async_call = safe_async_call;
|
|
2873
|
+
exports.safe_evaluate_context = safe_evaluate_context;
|
|
2860
2874
|
exports.safe_json_parse = safe_json_parse;
|
|
2861
2875
|
exports.safe_json_parse_arr = safe_json_parse_arr;
|
|
2862
2876
|
exports.safe_json_stringify = safe_json_stringify;
|
package/dist/small-fn.d.ts
CHANGED
|
@@ -16,7 +16,10 @@ export declare function unicodeToChar(u: number): string | null;
|
|
|
16
16
|
export declare function unicode_to_UTF8(u: number): number[] | null;
|
|
17
17
|
export declare function getFilledArray(n: number): any[];
|
|
18
18
|
export declare function copyText(text: string): boolean;
|
|
19
|
-
export declare function
|
|
19
|
+
export declare function safe_evaluate_context(str: any, g_ctx: () => any): {
|
|
20
|
+
is_err: boolean;
|
|
21
|
+
data: any;
|
|
22
|
+
};
|
|
20
23
|
export declare function safeExec<T extends (...args: any) => any>(fn?: T, ...args: Parameters<T>): any;
|
|
21
24
|
export declare function safeGetFromFuncOrData(fn: any, default_v?: any): any;
|
|
22
25
|
export declare function numberLikeCompare(a: number | string | boolean | null, b: number | string | boolean | null): boolean;
|
package/dist/typing.d.ts
CHANGED
|
@@ -736,7 +736,10 @@ declare function unicodeToChar(u: number): string | null;
|
|
|
736
736
|
declare function unicode_to_UTF8(u: number): number[] | null;
|
|
737
737
|
declare function getFilledArray(n: number): any[];
|
|
738
738
|
declare function copyText(text: string): boolean;
|
|
739
|
-
declare function
|
|
739
|
+
declare function safe_evaluate_context(str: any, g_ctx: () => any): {
|
|
740
|
+
is_err: boolean;
|
|
741
|
+
data: any;
|
|
742
|
+
};
|
|
740
743
|
declare function safeExec<T extends (...args: any) => any>(fn?: T, ...args: Parameters<T>): any;
|
|
741
744
|
declare function safeGetFromFuncOrData(fn: any, default_v?: any): any;
|
|
742
745
|
declare function numberLikeCompare(a: number | string | boolean | null, b: number | string | boolean | null): boolean;
|
|
@@ -939,5 +942,5 @@ declare function create_load_src(): (items: TMixOpt | TMixOpt[], node?: HTMLHead
|
|
|
939
942
|
declare function load_src(items: TMixOpt, node?: HTMLHeadElement): Promise<Element>;
|
|
940
943
|
declare function load_src(items: TMixOpt[], node?: HTMLHeadElement): Promise<Element[]>;
|
|
941
944
|
|
|
942
|
-
export { ARG_URS1_KEY, ARG_URS2_KEY, AggregateError, EMPTY_PLACEHOLDER, EventEmitter, MyLog, ROMAN_NUMERALS, TOKEN_KEY, all, alphabetical, assign, base64ToBinary, base64_to_image, boil, cache_fetch, calc_number, callable, camel, capitalize, chain, charToUTF8, charToUnicode, clone, cloneDeep, cluster, compose, confirm_operation, construct, copyText, counting, create_load_src, crush, dash, dayOf, dayjs_quarter, debounce, defer, diff, diff_between, downloadFile, draw,
|
|
945
|
+
export { ARG_URS1_KEY, ARG_URS2_KEY, AggregateError, EMPTY_PLACEHOLDER, EventEmitter, MyLog, ROMAN_NUMERALS, TOKEN_KEY, all, alphabetical, assign, base64ToBinary, base64_to_image, boil, cache_fetch, calc_number, callable, camel, capitalize, chain, charToUTF8, charToUnicode, clone, cloneDeep, cluster, compose, confirm_operation, construct, copyText, counting, create_load_src, crush, dash, dayOf, dayjs_quarter, debounce, defer, diff, diff_between, downloadFile, draw, expect_array, filter_obj_to_url_search, first, flat, fork, formatDate, formatDateTime, formatDateTimeNoSecond, formatTime, gen_encoded_char_svg, get, getDictionaries, getDictionariesEnumerations, getDictionaryLabel, getDictionaryValue, getDualModeOptions, getFilledArray, getFuckTimeInterval, getFutureDate, getMomentObj, getMomentRange, getOptionLabel, getOptionValue, getPresetOptions, getSameOptions, getSearchParamsAll, getSearchParamsValue, getSimpleOptions, get_global, group, guard, hasOwn, identity, image_to_base64, inRange, intersects, invert, isArray, isBoolean, isDate, isEmpty, isEqual, isFloat, isFunction, isInt, isMoment, isNil, isNull, isNumber, isObject, isObjectLike, isPrimitive, isPromise, isString, isSymbol, iterate, keys, last, list, listify, load_src, lowerize, map, mapEntries, mapKeys, mapValues, max, memo, merge, merge_dict, merge_preset_options, min, noop, numberLikeCompare, objectify, omit, optionKey不详, optionKey其他, optionKey否, parallel, partial, partob, pascal, pick, presets_date, proxied, random, randomHex, random_word, range, reduce, replace, replaceOrAppend, retry, safeExec, safeGetFromFuncOrData, safe_async_call, safe_evaluate_context, safe_json_parse, safe_json_parse_arr, safe_json_stringify, safe_number_parse, scrollIntoView, select, series, set, setSearchParamsAll, setSearchParamsValue, shake, shift, shuffle, sift, simple_decrypt, simple_decrypt_str, simple_encrypt, simple_encrypt_str, size, sleep, snake, sort, speculate_on_display, sum, template, text_ellipsis, throttle, title, toFloat, toInt, toString, toggle, trim, tryit as try, tryit, uid, unicodeToChar, unicode_to_UTF8, unique, upperize, uuid, warpBase64Type, zip, zipToObject };
|
|
943
946
|
export type { AnyObject, Dayjs, DayjsConfigType, ICommonOption, PartialAll, PartialSome, PropertyKey$1 as PropertyKey, TCommonFileType };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noah-libjs/utils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.53",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"keywords": [],
|
|
35
35
|
"author": "",
|
|
36
36
|
"license": "MIT",
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "0a2872071da97ee0ef9226aef499595f21664d70"
|
|
38
38
|
}
|