@noah-libjs/utils 0.0.57 → 0.0.58

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 CHANGED
@@ -1440,6 +1440,29 @@ function object_to_formData(obj) {
1440
1440
  }
1441
1441
  return formData;
1442
1442
  }
1443
+ function object_to_searchparams(obj) {
1444
+ var params = new URLSearchParams();
1445
+ var _loop = function _loop(key) {
1446
+ var value = obj[key];
1447
+ // 过滤 undefined,null 转空字符串
1448
+ if (value === undefined) return 1; // continue
1449
+ if (value === null) value = "";
1450
+ // 数组处理:如 ids: [1,2,3] → ids=1&ids=2&ids=3
1451
+ if (Array.isArray(value)) {
1452
+ value.forEach(function (item) {
1453
+ params.append(key, item);
1454
+ });
1455
+ }
1456
+ // 普通值直接添加
1457
+ else {
1458
+ params.append(key, value);
1459
+ }
1460
+ };
1461
+ for (var key in obj) {
1462
+ if (_loop(key)) continue;
1463
+ }
1464
+ return params;
1465
+ }
1443
1466
  function safe_json_parse(str) {
1444
1467
  var retOnErr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1445
1468
  if (!str) return retOnErr;
@@ -2736,4 +2759,4 @@ function load_src(items, node) {
2736
2759
  var load_src_ = create_load_src();
2737
2760
  return load_src_(items, node);
2738
2761
  }
2739
- 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, object_to_formData, 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 };
2762
+ 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, object_to_formData, object_to_searchparams, 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/helper.d.ts CHANGED
@@ -11,3 +11,4 @@ export declare function toString(value: any): string;
11
11
  export declare function cloneDeep<T>(value: T): T | null;
12
12
  export declare function hasOwn(obj: AnyObject, key: PropertyKey): boolean;
13
13
  export declare function object_to_formData(obj: AnyObject, formData?: FormData, parentKey?: string): FormData;
14
+ export declare function object_to_searchparams(obj: AnyObject): URLSearchParams;
package/dist/lib.js CHANGED
@@ -1450,6 +1450,29 @@ function object_to_formData(obj) {
1450
1450
  }
1451
1451
  return formData;
1452
1452
  }
1453
+ function object_to_searchparams(obj) {
1454
+ var params = new URLSearchParams();
1455
+ var _loop = function _loop(key) {
1456
+ var value = obj[key];
1457
+ // 过滤 undefined,null 转空字符串
1458
+ if (value === undefined) return 1; // continue
1459
+ if (value === null) value = "";
1460
+ // 数组处理:如 ids: [1,2,3] → ids=1&ids=2&ids=3
1461
+ if (Array.isArray(value)) {
1462
+ value.forEach(function (item) {
1463
+ params.append(key, item);
1464
+ });
1465
+ }
1466
+ // 普通值直接添加
1467
+ else {
1468
+ params.append(key, value);
1469
+ }
1470
+ };
1471
+ for (var key in obj) {
1472
+ if (_loop(key)) continue;
1473
+ }
1474
+ return params;
1475
+ }
1453
1476
  function safe_json_parse(str) {
1454
1477
  var retOnErr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1455
1478
  if (!str) return retOnErr;
@@ -2867,6 +2890,7 @@ exports.min = min;
2867
2890
  exports.noop = noop;
2868
2891
  exports.numberLikeCompare = numberLikeCompare;
2869
2892
  exports.object_to_formData = object_to_formData;
2893
+ exports.object_to_searchparams = object_to_searchparams;
2870
2894
  exports.objectify = objectify;
2871
2895
  exports.omit = omit;
2872
2896
  exports["optionKey不详"] = optionKey不详;
package/dist/typing.d.ts CHANGED
@@ -715,6 +715,7 @@ declare function toString(value: any): string;
715
715
  declare function cloneDeep<T>(value: T): T | null;
716
716
  declare function hasOwn(obj: AnyObject, key: PropertyKey): boolean;
717
717
  declare function object_to_formData(obj: AnyObject, formData?: FormData, parentKey?: string): FormData;
718
+ declare function object_to_searchparams(obj: AnyObject): URLSearchParams;
718
719
 
719
720
  declare function safe_json_parse<T = any>(str?: any, retOnErr?: T | null): T | null;
720
721
  declare function safe_json_stringify(obj?: any): string;
@@ -943,5 +944,5 @@ declare function create_load_src(): (items: TMixOpt | TMixOpt[], node?: HTMLHead
943
944
  declare function load_src(items: TMixOpt, node?: HTMLHeadElement): Promise<Element>;
944
945
  declare function load_src(items: TMixOpt[], node?: HTMLHeadElement): Promise<Element[]>;
945
946
 
946
- 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, object_to_formData, 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 };
947
+ 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, object_to_formData, object_to_searchparams, 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 };
947
948
  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.57",
3
+ "version": "0.0.58",
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": "09002308afa59b067c54feba380fcde3b3c4bd11"
37
+ "gitHead": "53cc4a32579d7255f622cfb51a73678a45962f56"
38
38
  }