ansuko 1.3.4 → 1.3.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/README.zh.md +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +8 -1
- package/package.json +1 -1
package/README.zh.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -146,6 +146,7 @@ declare const castArray: <T>(value: T | T[] | null | undefined) => T[];
|
|
|
146
146
|
* @category Object Utilities
|
|
147
147
|
*/
|
|
148
148
|
declare const changes: <T extends Record<string, any>, E extends Record<string, any>>(sourceValue: T, currentValue: E, keys: string[], options?: ChangesOptions, finallyCallback?: ChangesAfterFinallyCallback<Record<string, any>>, notEmptyCallback?: ChangesAfterCallback<Record<string, any>>) => Record<string, any>;
|
|
149
|
+
declare const strWrap: (value: string, wrapper: string, whenInvalid?: any) => string | null | undefined;
|
|
149
150
|
/**
|
|
150
151
|
* Executes a function and returns undefined if an error occurs.
|
|
151
152
|
* For functions returning a Promise, returns undefined if the Promise is rejected.
|
|
@@ -234,6 +235,7 @@ export interface AnsukoType {
|
|
|
234
235
|
swallow: typeof swallow;
|
|
235
236
|
swallowMap: typeof swallowMap;
|
|
236
237
|
arrayDepth: typeof arrayDepth;
|
|
238
|
+
strWrap: typeof strWrap;
|
|
237
239
|
isEmpty: typeof isEmpty;
|
|
238
240
|
toNumber: typeof toNumber;
|
|
239
241
|
castArray: typeof castArray;
|
|
@@ -544,4 +546,4 @@ export interface AnsukoType {
|
|
|
544
546
|
}
|
|
545
547
|
declare const _default: AnsukoType;
|
|
546
548
|
export default _default;
|
|
547
|
-
export { isEmpty, toNumber, boolIf, isValidStr, valueOr, equalsOr, waited, parseJSON, jsonStringify, castArray, changes, swallow, swallowMap, arrayDepth, };
|
|
549
|
+
export { isEmpty, toNumber, boolIf, isValidStr, valueOr, equalsOr, waited, parseJSON, jsonStringify, castArray, changes, strWrap, swallow, swallowMap, arrayDepth, };
|
package/dist/index.js
CHANGED
|
@@ -447,6 +447,12 @@ const changes = (sourceValue, currentValue, keys, options, finallyCallback, notE
|
|
|
447
447
|
}
|
|
448
448
|
return diff;
|
|
449
449
|
};
|
|
450
|
+
const strWrap = (value, wrapper, whenInvalid = undefined) => {
|
|
451
|
+
if (!isValidStr(value)) {
|
|
452
|
+
return whenInvalid;
|
|
453
|
+
}
|
|
454
|
+
return `${wrapper}${value}${wrapper}`;
|
|
455
|
+
};
|
|
450
456
|
/**
|
|
451
457
|
* Executes a function and returns undefined if an error occurs.
|
|
452
458
|
* For functions returning a Promise, returns undefined if the Promise is rejected.
|
|
@@ -564,6 +570,7 @@ export default {
|
|
|
564
570
|
isEmptyOrg: _.isEmpty,
|
|
565
571
|
toNumberOrg: _.toNumber,
|
|
566
572
|
castArrayOrg: _.castArray,
|
|
573
|
+
strWrap,
|
|
567
574
|
isEmpty,
|
|
568
575
|
toNumber,
|
|
569
576
|
toBool,
|
|
@@ -583,4 +590,4 @@ export default {
|
|
|
583
590
|
arrayDepth,
|
|
584
591
|
};
|
|
585
592
|
// 個別エクスポートはそのまま
|
|
586
|
-
export { isEmpty, toNumber, boolIf, isValidStr, valueOr, equalsOr, waited, parseJSON, jsonStringify, castArray, changes, swallow, swallowMap, arrayDepth, };
|
|
593
|
+
export { isEmpty, toNumber, boolIf, isValidStr, valueOr, equalsOr, waited, parseJSON, jsonStringify, castArray, changes, strWrap, swallow, swallowMap, arrayDepth, };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ansuko",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.6",
|
|
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",
|