ansuko 1.2.14 → 1.3.0

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/index.d.ts CHANGED
@@ -144,15 +144,15 @@ declare const changes: <T extends Record<string, any>, E extends Record<string,
144
144
  *
145
145
  * @example
146
146
  * // Synchronous function
147
- * ignore(() => data.remove() )
147
+ * swallow(() => data.remove() )
148
148
  * // => undefined (error ignored)
149
149
  *
150
150
  * @example
151
151
  * // Asynchronous function
152
- * const data = await ignore(async () => await fetchData());
152
+ * const data = await swallow(async () => await fetchData());
153
153
  * // => data or undefined
154
154
  */
155
- declare const ignore: <T>(fn: () => T) => T extends Promise<infer U> ? Promise<U | undefined> : T | undefined;
155
+ declare const swallow: <T>(fn: () => T) => T extends Promise<infer U> ? Promise<U | undefined> : T | undefined;
156
156
  /**
157
157
  * Maps over an array, treating errors as undefined.
158
158
  * When compact is true, filters out undefined results (errors).
@@ -166,20 +166,20 @@ declare const ignore: <T>(fn: () => T) => T extends Promise<infer U> ? Promise<U
166
166
  *
167
167
  * @example
168
168
  * // Keep errors as undefined
169
- * const results = ignoreMap(items, item => processItem(item));
169
+ * const results = swallowMap(items, item => processItem(item));
170
170
  * // => [result1, undefined, result3, ...]
171
171
  *
172
172
  * @example
173
173
  * // Filter out errors (compact)
174
- * const results = ignoreMap(items, item => processItem(item), true);
174
+ * const results = swallowMap(items, item => processItem(item), true);
175
175
  * // => [result1, result3, ...]
176
176
  *
177
177
  * @example
178
178
  * // Async processing
179
- * const data = await ignoreMap(urls, async url => await fetch(url), true);
179
+ * const data = await swallowMap(urls, async url => await fetch(url), true);
180
180
  * // => array of successful responses only
181
181
  */
182
- declare const ignoreMap: <T, U>(array: T[] | undefined | null, fn: (item: T, index: number) => U, compact?: boolean) => U extends Promise<infer V> ? Promise<V[]> : U[];
182
+ declare const swallowMap: <T, U>(array: T[] | undefined | null, fn: (item: T, index: number) => U, compact?: boolean) => U extends Promise<infer V> ? Promise<V[]> : U[];
183
183
  /**
184
184
  * Returns nesting depth of arrays. Non-array: 0; empty array: 1. Uses minimum depth for mixed nesting.
185
185
  * @param ary - Array
@@ -221,8 +221,8 @@ export interface AnsukoType extends Omit<_.LoDashStatic, "castArray" | "isEmpty"
221
221
  jsonStringify: typeof jsonStringify;
222
222
  castArray: typeof castArray;
223
223
  changes: typeof changes;
224
- ignore: typeof ignore;
225
- ignoreMap: typeof ignoreMap;
224
+ swallow: typeof swallow;
225
+ swallowMap: typeof swallowMap;
226
226
  size: typeof _.size;
227
227
  isNil: typeof _.isNil;
228
228
  debounce: typeof _.debounce;
@@ -243,4 +243,4 @@ export interface AnsukoType extends Omit<_.LoDashStatic, "castArray" | "isEmpty"
243
243
  }
244
244
  declare const _default: AnsukoType;
245
245
  export default _default;
246
- export { isEmpty, toNumber, boolIf, isValidStr, valueOr, equalsOr, waited, parseJSON, jsonStringify, castArray, changes, ignore, ignoreMap, arrayDepth, };
246
+ export { isEmpty, toNumber, boolIf, isValidStr, valueOr, equalsOr, waited, parseJSON, jsonStringify, castArray, changes, swallow, swallowMap, arrayDepth, };
package/dist/index.js CHANGED
@@ -457,15 +457,15 @@ const changes = (sourceValue, currentValue, keys, options, finallyCallback, notE
457
457
  *
458
458
  * @example
459
459
  * // Synchronous function
460
- * ignore(() => data.remove() )
460
+ * swallow(() => data.remove() )
461
461
  * // => undefined (error ignored)
462
462
  *
463
463
  * @example
464
464
  * // Asynchronous function
465
- * const data = await ignore(async () => await fetchData());
465
+ * const data = await swallow(async () => await fetchData());
466
466
  * // => data or undefined
467
467
  */
468
- const ignore = (fn) => {
468
+ const swallow = (fn) => {
469
469
  try {
470
470
  const result = fn();
471
471
  if (result instanceof Promise) {
@@ -490,20 +490,20 @@ const ignore = (fn) => {
490
490
  *
491
491
  * @example
492
492
  * // Keep errors as undefined
493
- * const results = ignoreMap(items, item => processItem(item));
493
+ * const results = swallowMap(items, item => processItem(item));
494
494
  * // => [result1, undefined, result3, ...]
495
495
  *
496
496
  * @example
497
497
  * // Filter out errors (compact)
498
- * const results = ignoreMap(items, item => processItem(item), true);
498
+ * const results = swallowMap(items, item => processItem(item), true);
499
499
  * // => [result1, result3, ...]
500
500
  *
501
501
  * @example
502
502
  * // Async processing
503
- * const data = await ignoreMap(urls, async url => await fetch(url), true);
503
+ * const data = await swallowMap(urls, async url => await fetch(url), true);
504
504
  * // => array of successful responses only
505
505
  */
506
- const ignoreMap = (array, fn, compact) => {
506
+ const swallowMap = (array, fn, compact) => {
507
507
  if (!array)
508
508
  return [];
509
509
  const results = array.map((item, index) => {
@@ -578,9 +578,9 @@ export default {
578
578
  jsonStringify,
579
579
  castArray,
580
580
  changes,
581
- ignore,
582
- ignoreMap,
581
+ swallow,
582
+ swallowMap,
583
583
  arrayDepth,
584
584
  };
585
585
  // 個別エクスポートはそのまま
586
- export { isEmpty, toNumber, boolIf, isValidStr, valueOr, equalsOr, waited, parseJSON, jsonStringify, castArray, changes, ignore, ignoreMap, arrayDepth, };
586
+ export { isEmpty, toNumber, boolIf, isValidStr, valueOr, equalsOr, waited, parseJSON, jsonStringify, castArray, changes, swallow, swallowMap, arrayDepth, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ansuko",
3
- "version": "1.2.14",
3
+ "version": "1.3.0",
4
4
  "description": "A modern JavaScript/TypeScript utility library that extends lodash with practical, intuitive behaviors. Fixes lodash quirks, adds Promise support, Japanese text processing, and GeoJSON utilities.",
5
5
  "keywords": [
6
6
  "lodash",