@noah-libjs/utils 0.0.5 → 0.0.6
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 +7 -3
- package/dist/lib.js +7 -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,10 @@ 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
|
+
return (_a = window !== null && window !== void 0 ? window : globalThis) !== null && _a !== void 0 ? _a : global;
|
|
1504
|
+
}
|
|
1501
1505
|
function getSearchParamsValue(key) {
|
|
1502
1506
|
var _a, _b;
|
|
1503
1507
|
var url = new URL(location.toString());
|
|
@@ -1537,7 +1541,7 @@ function scrollIntoView(symbol) {
|
|
|
1537
1541
|
}
|
|
1538
1542
|
}
|
|
1539
1543
|
function base64ToBinary(data, type) {
|
|
1540
|
-
var raw =
|
|
1544
|
+
var raw = get_global().atob(data);
|
|
1541
1545
|
var uInt8Array = new Uint8Array(raw.length);
|
|
1542
1546
|
for (var i = 0; i < raw.length; i++) {
|
|
1543
1547
|
uInt8Array[i] = raw.charCodeAt(i);
|
|
@@ -1735,7 +1739,7 @@ function safe_async_call(cb) {
|
|
|
1735
1739
|
}, _callee8);
|
|
1736
1740
|
}));
|
|
1737
1741
|
}
|
|
1738
|
-
|
|
1742
|
+
get_global().safe_async_call = safe_async_call;
|
|
1739
1743
|
var global_cache_map = {};
|
|
1740
1744
|
function cache_fetch(key, cb) {
|
|
1741
1745
|
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
|
|
@@ -2472,4 +2476,4 @@ function getDictionaryValue(type, label) {
|
|
|
2472
2476
|
function merge_dict(ops) {
|
|
2473
2477
|
Object.assign(dic_map, ops);
|
|
2474
2478
|
}
|
|
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 };
|
|
2479
|
+
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,10 @@ 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
|
+
return (_a = window !== null && window !== void 0 ? window : globalThis) !== null && _a !== void 0 ? _a : global;
|
|
1514
|
+
}
|
|
1511
1515
|
function getSearchParamsValue(key) {
|
|
1512
1516
|
var _a, _b;
|
|
1513
1517
|
var url = new URL(location.toString());
|
|
@@ -1547,7 +1551,7 @@ function scrollIntoView(symbol) {
|
|
|
1547
1551
|
}
|
|
1548
1552
|
}
|
|
1549
1553
|
function base64ToBinary(data, type) {
|
|
1550
|
-
var raw =
|
|
1554
|
+
var raw = get_global().atob(data);
|
|
1551
1555
|
var uInt8Array = new Uint8Array(raw.length);
|
|
1552
1556
|
for (var i = 0; i < raw.length; i++) {
|
|
1553
1557
|
uInt8Array[i] = raw.charCodeAt(i);
|
|
@@ -1745,7 +1749,7 @@ function safe_async_call(cb) {
|
|
|
1745
1749
|
}, _callee8);
|
|
1746
1750
|
}));
|
|
1747
1751
|
}
|
|
1748
|
-
|
|
1752
|
+
get_global().safe_async_call = safe_async_call;
|
|
1749
1753
|
var global_cache_map = {};
|
|
1750
1754
|
function cache_fetch(key, cb) {
|
|
1751
1755
|
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
|
|
@@ -2553,6 +2557,7 @@ exports.getSameOptions = getSameOptions;
|
|
|
2553
2557
|
exports.getSearchParamsAll = getSearchParamsAll;
|
|
2554
2558
|
exports.getSearchParamsValue = getSearchParamsValue;
|
|
2555
2559
|
exports.getSimpleOptions = getSimpleOptions;
|
|
2560
|
+
exports.get_global = get_global;
|
|
2556
2561
|
exports.group = group;
|
|
2557
2562
|
exports.guard = guard;
|
|
2558
2563
|
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(): Window & 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(): Window & 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.6",
|
|
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": "c9728dacb73b81f38c4c9ff2d3e122a904afe9d0"
|
|
38
38
|
}
|