@fastkit/helpers
Advanced tools
Comparing version 0.8.18 to 0.9.0
@@ -86,2 +86,24 @@ 'use strict'; | ||
} | ||
/** | ||
* Obtains a string with the first letter of the specified string capitalized | ||
* | ||
* - `"helloWorld"` -> `"HelloWorld"` | ||
* | ||
* @param str - String of conversion source | ||
* @returns String with first letter converted to uppercase | ||
*/ | ||
function capitalize(str) { | ||
return (str.charAt(0).toUpperCase() + str.slice(1)); | ||
} | ||
/** | ||
* Obtains a string with the first letter of the specified string in lowercase. | ||
* | ||
* - `"HelloWorld"` -> `"helloWorld"` | ||
* | ||
* @param str - String of conversion source | ||
* @returns String with first letter converted to lowercase | ||
*/ | ||
function uncapitalize(str) { | ||
return (str.charAt(0).toLowerCase() + str.slice(1)); | ||
} | ||
@@ -157,2 +179,20 @@ const HAS_SET = typeof Set !== 'undefined'; | ||
/** | ||
* Checks if the specified variable is a not Nullable. | ||
* | ||
* @param value - Variables to be examined | ||
* | ||
* @returns | ||
* - `null` -> `false` | ||
* - `undefined` -> `false` | ||
* - `0` -> `true` | ||
* - `1` -> `true` | ||
* - `""` -> `true` | ||
* - `"0"` -> `true` | ||
* - `{}` -> `true` | ||
* - `[]` -> `true` | ||
*/ | ||
function inNonNullable(value) { | ||
return value != null; | ||
} | ||
/** | ||
* Checks if the specified variable is a NonNull object. | ||
@@ -368,2 +408,5 @@ * | ||
} | ||
function arrayUnique(array) { | ||
return Array.from(new Set(array)); | ||
} | ||
@@ -967,2 +1010,3 @@ const HAS_BUFFER = typeof Buffer !== 'undefined'; | ||
else { | ||
// @FIXME | ||
return mergeObject(target, source, _options); | ||
@@ -996,3 +1040,3 @@ } | ||
if (indexSignatureScheme) { | ||
const baseKeys = Object.keys(base); | ||
const baseKeys = Object.keys(base); // @FIXME | ||
const _scheme = {}; | ||
@@ -1064,3 +1108,5 @@ baseKeys.forEach((key) => { | ||
exports.arrayRemove = arrayRemove; | ||
exports.arrayUnique = arrayUnique; | ||
exports.attemptFocus = attemptFocus; | ||
exports.capitalize = capitalize; | ||
exports.clone = clone; | ||
@@ -1081,2 +1127,3 @@ exports.consoleColorString = consoleColorString; | ||
exports.getCrypto = getCrypto; | ||
exports.inNonNullable = inNonNullable; | ||
exports.isArrayBufferView = isArrayBufferView; | ||
@@ -1128,1 +1175,2 @@ exports.isBuffer = isBuffer; | ||
exports.traverseAndFlattenComparatorCondition = traverseAndFlattenComparatorCondition; | ||
exports.uncapitalize = uncapitalize; |
@@ -86,2 +86,24 @@ 'use strict'; | ||
} | ||
/** | ||
* Obtains a string with the first letter of the specified string capitalized | ||
* | ||
* - `"helloWorld"` -> `"HelloWorld"` | ||
* | ||
* @param str - String of conversion source | ||
* @returns String with first letter converted to uppercase | ||
*/ | ||
function capitalize(str) { | ||
return (str.charAt(0).toUpperCase() + str.slice(1)); | ||
} | ||
/** | ||
* Obtains a string with the first letter of the specified string in lowercase. | ||
* | ||
* - `"HelloWorld"` -> `"helloWorld"` | ||
* | ||
* @param str - String of conversion source | ||
* @returns String with first letter converted to lowercase | ||
*/ | ||
function uncapitalize(str) { | ||
return (str.charAt(0).toLowerCase() + str.slice(1)); | ||
} | ||
@@ -157,2 +179,20 @@ const HAS_SET = typeof Set !== 'undefined'; | ||
/** | ||
* Checks if the specified variable is a not Nullable. | ||
* | ||
* @param value - Variables to be examined | ||
* | ||
* @returns | ||
* - `null` -> `false` | ||
* - `undefined` -> `false` | ||
* - `0` -> `true` | ||
* - `1` -> `true` | ||
* - `""` -> `true` | ||
* - `"0"` -> `true` | ||
* - `{}` -> `true` | ||
* - `[]` -> `true` | ||
*/ | ||
function inNonNullable(value) { | ||
return value != null; | ||
} | ||
/** | ||
* Checks if the specified variable is a NonNull object. | ||
@@ -368,2 +408,5 @@ * | ||
} | ||
function arrayUnique(array) { | ||
return Array.from(new Set(array)); | ||
} | ||
@@ -967,2 +1010,3 @@ const HAS_BUFFER = typeof Buffer !== 'undefined'; | ||
else { | ||
// @FIXME | ||
return mergeObject(target, source, _options); | ||
@@ -996,3 +1040,3 @@ } | ||
if (indexSignatureScheme) { | ||
const baseKeys = Object.keys(base); | ||
const baseKeys = Object.keys(base); // @FIXME | ||
const _scheme = {}; | ||
@@ -1064,3 +1108,5 @@ baseKeys.forEach((key) => { | ||
exports.arrayRemove = arrayRemove; | ||
exports.arrayUnique = arrayUnique; | ||
exports.attemptFocus = attemptFocus; | ||
exports.capitalize = capitalize; | ||
exports.clone = clone; | ||
@@ -1081,2 +1127,3 @@ exports.consoleColorString = consoleColorString; | ||
exports.getCrypto = getCrypto; | ||
exports.inNonNullable = inNonNullable; | ||
exports.isArrayBufferView = isArrayBufferView; | ||
@@ -1128,1 +1175,2 @@ exports.isBuffer = isBuffer; | ||
exports.traverseAndFlattenComparatorCondition = traverseAndFlattenComparatorCondition; | ||
exports.uncapitalize = uncapitalize; |
@@ -30,2 +30,4 @@ /// <reference types="node" /> | ||
export declare function arrayUnique<T>(array: T[]): T[]; | ||
export declare function attemptFocus(element: HTMLElement): boolean; | ||
@@ -40,2 +42,12 @@ | ||
/** | ||
* Obtains a string with the first letter of the specified string capitalized | ||
* | ||
* - `"helloWorld"` -> `"HelloWorld"` | ||
* | ||
* @param str - String of conversion source | ||
* @returns String with first letter converted to uppercase | ||
*/ | ||
export declare function capitalize<T extends string>(str: T): Capitalize<T>; | ||
export declare const clone: <T = any>(obj: T) => T; | ||
@@ -132,3 +144,3 @@ | ||
export declare type DeepPartial<T> = T extends Record<keyof any, unknown> ? { | ||
export declare type DeepPartial<T> = T extends Function ? T : T extends object ? { | ||
[P in keyof T]?: DeepPartial<T[P]>; | ||
@@ -189,2 +201,19 @@ } : T; | ||
/** | ||
* Checks if the specified variable is a not Nullable. | ||
* | ||
* @param value - Variables to be examined | ||
* | ||
* @returns | ||
* - `null` -> `false` | ||
* - `undefined` -> `false` | ||
* - `0` -> `true` | ||
* - `1` -> `true` | ||
* - `""` -> `true` | ||
* - `"0"` -> `true` | ||
* - `{}` -> `true` | ||
* - `[]` -> `true` | ||
*/ | ||
export declare function inNonNullable<T>(value: T): value is Exclude<T, null | undefined>; | ||
export declare function isArrayBufferView(source: unknown): source is ArrayBufferView; | ||
@@ -379,2 +408,4 @@ | ||
export declare type Primitive = bigint | boolean | null | number | string | symbol | undefined; | ||
export declare function pushDynamicStyle(styleContent: string): void; | ||
@@ -386,3 +417,3 @@ | ||
export declare function removeUndef<T extends Record<string, unknown>>(obj: T, deep?: boolean): T; | ||
export declare function removeUndef<T extends Record<string, any>>(obj: T, deep?: boolean): T; | ||
@@ -428,2 +459,12 @@ export declare interface ResolvedDeepMergeOptions extends Omit<DeepMergeOptions, 'isMergeableObject'>, Required<Pick<DeepMergeOptions, 'isMergeableObject'>> { | ||
/** | ||
* Obtains a string with the first letter of the specified string in lowercase. | ||
* | ||
* - `"HelloWorld"` -> `"helloWorld"` | ||
* | ||
* @param str - String of conversion source | ||
* @returns String with first letter converted to lowercase | ||
*/ | ||
export declare function uncapitalize<T extends string>(str: T): Uncapitalize<T>; | ||
export declare type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; | ||
@@ -430,0 +471,0 @@ |
{ | ||
"name": "@fastkit/helpers", | ||
"version": "0.8.18", | ||
"description": "@fastkit/helpers", | ||
"version": "0.9.0", | ||
"description": "A small collection of helper implementations for processing primitive values and objects.", | ||
"buildOptions": { | ||
"name": "Helpers" | ||
}, | ||
"_docs": { | ||
"scope": "", | ||
"feature": "", | ||
"description": { | ||
"en": "A small collection of helper implementations for processing primitive values and objects.", | ||
"ja": "プリミティブな値やオブジェクトを処理するための小さなヘルパー実装のコレクションです。" | ||
} | ||
}, | ||
"main": "index.js", | ||
@@ -20,3 +28,4 @@ "module": "dist/helpers.mjs", | ||
"keywords": [ | ||
"fastkit" | ||
"fastkit", | ||
"helper" | ||
], | ||
@@ -23,0 +32,0 @@ "author": "dadajam4", |
@@ -1,1 +0,4 @@ | ||
# @fastkit/helpers | ||
# @fastkit/helpers | ||
## Documentation | ||
https://dadajam4.github.io/fastkit/helpers/ |
Sorry, the diff of this file is not supported yet
129786
8
3688
5