@noah-libjs/utils 0.0.5 → 0.0.7
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 +11 -3
- package/dist/lib.js +11 -2
- package/dist/small-fn.d.ts +1 -0
- package/dist/typing.d.ts +2 -1
- package/package.json +2 -2
package/dist/es.js
CHANGED
|
@@ -1498,6 +1498,14 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
1498
1498
|
// export function sleep(sec: number) {
|
|
1499
1499
|
// return new Promise<void>((resolve) => setTimeout(resolve, sec * 1000))
|
|
1500
1500
|
// }
|
|
1501
|
+
function get_global() {
|
|
1502
|
+
var _a;
|
|
1503
|
+
try {
|
|
1504
|
+
return (_a = globalThis !== null && globalThis !== void 0 ? globalThis : window) !== null && _a !== void 0 ? _a : global;
|
|
1505
|
+
} catch (error) {
|
|
1506
|
+
return {};
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1501
1509
|
function getSearchParamsValue(key) {
|
|
1502
1510
|
var _a, _b;
|
|
1503
1511
|
var url = new URL(location.toString());
|
|
@@ -1537,7 +1545,7 @@ function scrollIntoView(symbol) {
|
|
|
1537
1545
|
}
|
|
1538
1546
|
}
|
|
1539
1547
|
function base64ToBinary(data, type) {
|
|
1540
|
-
var raw =
|
|
1548
|
+
var raw = get_global().atob(data);
|
|
1541
1549
|
var uInt8Array = new Uint8Array(raw.length);
|
|
1542
1550
|
for (var i = 0; i < raw.length; i++) {
|
|
1543
1551
|
uInt8Array[i] = raw.charCodeAt(i);
|
|
@@ -1735,7 +1743,7 @@ function safe_async_call(cb) {
|
|
|
1735
1743
|
}, _callee8);
|
|
1736
1744
|
}));
|
|
1737
1745
|
}
|
|
1738
|
-
|
|
1746
|
+
get_global().safe_async_call = safe_async_call;
|
|
1739
1747
|
var global_cache_map = {};
|
|
1740
1748
|
function cache_fetch(key, cb) {
|
|
1741
1749
|
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
|
|
@@ -2472,4 +2480,4 @@ function getDictionaryValue(type, label) {
|
|
|
2472
2480
|
function merge_dict(ops) {
|
|
2473
2481
|
Object.assign(dic_map, ops);
|
|
2474
2482
|
}
|
|
2475
|
-
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, callable, camel, capitalize, chain, charToUTF8, charToUnicode, clone, cloneDeep, cluster, compose, confirm_operation, construct, copyText, counting, crush, dash, 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, group, guard, 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, 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_fetch_options, 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, throttle, title, toFloat, toInt, toString, toggle, trim, tryit as try, tryit, uid, unicodeToChar, unicode_to_UTF8, unique, upperize, uuid, warpBase64Type, zip, zipToObject };
|
|
2483
|
+
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, callable, camel, capitalize, chain, charToUTF8, charToUnicode, clone, cloneDeep, cluster, compose, confirm_operation, construct, copyText, counting, crush, dash, 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, 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, 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_fetch_options, 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, 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
|
@@ -1508,6 +1508,14 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
1508
1508
|
// export function sleep(sec: number) {
|
|
1509
1509
|
// return new Promise<void>((resolve) => setTimeout(resolve, sec * 1000))
|
|
1510
1510
|
// }
|
|
1511
|
+
function get_global() {
|
|
1512
|
+
var _a;
|
|
1513
|
+
try {
|
|
1514
|
+
return (_a = globalThis !== null && globalThis !== void 0 ? globalThis : window) !== null && _a !== void 0 ? _a : global;
|
|
1515
|
+
} catch (error) {
|
|
1516
|
+
return {};
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1511
1519
|
function getSearchParamsValue(key) {
|
|
1512
1520
|
var _a, _b;
|
|
1513
1521
|
var url = new URL(location.toString());
|
|
@@ -1547,7 +1555,7 @@ function scrollIntoView(symbol) {
|
|
|
1547
1555
|
}
|
|
1548
1556
|
}
|
|
1549
1557
|
function base64ToBinary(data, type) {
|
|
1550
|
-
var raw =
|
|
1558
|
+
var raw = get_global().atob(data);
|
|
1551
1559
|
var uInt8Array = new Uint8Array(raw.length);
|
|
1552
1560
|
for (var i = 0; i < raw.length; i++) {
|
|
1553
1561
|
uInt8Array[i] = raw.charCodeAt(i);
|
|
@@ -1745,7 +1753,7 @@ function safe_async_call(cb) {
|
|
|
1745
1753
|
}, _callee8);
|
|
1746
1754
|
}));
|
|
1747
1755
|
}
|
|
1748
|
-
|
|
1756
|
+
get_global().safe_async_call = safe_async_call;
|
|
1749
1757
|
var global_cache_map = {};
|
|
1750
1758
|
function cache_fetch(key, cb) {
|
|
1751
1759
|
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
|
|
@@ -2553,6 +2561,7 @@ exports.getSameOptions = getSameOptions;
|
|
|
2553
2561
|
exports.getSearchParamsAll = getSearchParamsAll;
|
|
2554
2562
|
exports.getSearchParamsValue = getSearchParamsValue;
|
|
2555
2563
|
exports.getSimpleOptions = getSimpleOptions;
|
|
2564
|
+
exports.get_global = get_global;
|
|
2556
2565
|
exports.group = group;
|
|
2557
2566
|
exports.guard = guard;
|
|
2558
2567
|
exports.identity = identity;
|
package/dist/small-fn.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AnyObject } from "./type-utils";
|
|
2
2
|
export type TCommonFileType = 'application/vnd.ms-excel' | 'text/csv;charset=utf-8' | 'application/msword';
|
|
3
|
+
export declare function get_global(): typeof globalThis;
|
|
3
4
|
export declare function getSearchParamsValue(key: string): string | null;
|
|
4
5
|
export declare function getSearchParamsAll(url?: URL): AnyObject<string>;
|
|
5
6
|
export declare function setSearchParamsValue(key: string, value: string | number): URL;
|
package/dist/typing.d.ts
CHANGED
|
@@ -716,6 +716,7 @@ type AnyObject<T = any> = {
|
|
|
716
716
|
};
|
|
717
717
|
|
|
718
718
|
type TCommonFileType = 'application/vnd.ms-excel' | 'text/csv;charset=utf-8' | 'application/msword';
|
|
719
|
+
declare function get_global(): typeof globalThis;
|
|
719
720
|
declare function getSearchParamsValue(key: string): string | null;
|
|
720
721
|
declare function getSearchParamsAll(url?: URL): AnyObject<string>;
|
|
721
722
|
declare function setSearchParamsValue(key: string, value: string | number): URL;
|
|
@@ -915,5 +916,5 @@ declare function getDictionaryLabel(type: string, value: string | number): strin
|
|
|
915
916
|
declare function getDictionaryValue(type: string, label: string): number | null | undefined;
|
|
916
917
|
declare function merge_dict(ops: AnyObject<IDictionary>): void;
|
|
917
918
|
|
|
918
|
-
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, callable, camel, capitalize, chain, charToUTF8, charToUnicode, clone, cloneDeep, cluster, compose, confirm_operation, construct, copyText, counting, crush, dash, 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, group, guard, 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, 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_fetch_options, 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, throttle, title, toFloat, toInt, toString, toggle, trim, tryit as try, tryit, uid, unicodeToChar, unicode_to_UTF8, unique, upperize, uuid, warpBase64Type, zip, zipToObject };
|
|
919
|
+
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, callable, camel, capitalize, chain, charToUTF8, charToUnicode, clone, cloneDeep, cluster, compose, confirm_operation, construct, copyText, counting, crush, dash, 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, 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, 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_fetch_options, 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, throttle, title, toFloat, toInt, toString, toggle, trim, tryit as try, tryit, uid, unicodeToChar, unicode_to_UTF8, unique, upperize, uuid, warpBase64Type, zip, zipToObject };
|
|
919
920
|
export type { AnyObject, Dayjs, DayjsConfigType, ICommonOption, PartialAll, PartialSome, TCommonFileType, T_FETCH_OPTIONS };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noah-libjs/utils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
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": "fcd560c4526837addb257776124afb9381853236"
|
|
38
38
|
}
|