
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
@fastkit/helpers
Advanced tools
A small collection of helper implementations for processing primitive values and objects.
š English | ę„ę¬čŖ
A collection of small helper implementations for processing primitive values and objects.
npm install @fastkit/helpers
# or
pnpm add @fastkit/helpers
import {
capitalize,
toHalfWidth,
stripIndent,
removeSpace
} from '@fastkit/helpers';
// Capitalize the first character
capitalize('helloWorld'); // ā 'HelloWorld'
// Convert full-width characters to half-width
toHalfWidth('H$LLOćWORLD'); // ā 'HELLO WORLD'
// Normalize indentation
const code = stripIndent(`
const message = 'Hello';
console.log(message);
`);
// Remove spaces
removeSpace('Hello World'); // ā 'HelloWorld'
import {
arrayUnique,
arrayRemove,
range,
flattenRecursiveArray
} from '@fastkit/helpers';
// Remove duplicates
arrayUnique([1, 2, 2, 3, 3]); // ā [1, 2, 3]
// Remove element (modifies original array)
const arr = [1, 2, 3];
arrayRemove(arr, 2); // arr becomes [1, 3]
// Generate range array
range(3); // ā [0, 1, 2]
range(3, 5); // ā [5, 6, 7]
// Flatten recursive array
flattenRecursiveArray([1, [2, [3, 4]]]); // ā [1, 2, 3, 4]
import {
isPlainObject,
pickProperties,
omitProperties,
removeUndef,
mixin
} from '@fastkit/helpers';
// Check if plain object
isPlainObject({}); // ā true
isPlainObject(new Date()); // ā false
// Select properties
const obj = { a: 1, b: 2, c: 3 };
pickProperties(obj, ['a', 'c']); // ā { a: 1, c: 3 }
// Exclude properties
omitProperties(obj, ['b']); // ā { a: 1, c: 3 }
// Remove undefined properties
removeUndef({ a: 1, b: undefined, c: 3 }); // ā { a: 1, c: 3 }
// Mixin objects
const base = { a: 1 };
const trait = { b: 2 };
const mixed = mixin(base, trait); // { a: 1, b: 2 }
import {
isEmpty,
notEmptyValue,
inNonNullable,
toNumber
} from '@fastkit/helpers';
// Empty value check
isEmpty(''); // ā true
isEmpty([]); // ā true
isEmpty(null); // ā true
isEmpty('hello'); // ā false
// Get first non-empty value
notEmptyValue(['', null, 'hello']); // ā 'hello'
// null/undefined check
inNonNullable(value); // value is not null | undefined
// Number conversion
toNumber('123'); // ā 123
toNumber('123.45'); // ā 123.45
capitalize<T extends string>(str: T): Capitalize<T>Capitalizes the first character of a string
uncapitalize<T extends string>(str: T): Uncapitalize<T>Uncapitalizes the first character of a string
toHalfWidth(source: string | null | undefined): stringConverts full-width characters to half-width
removeSpace(source: string | null | undefined): stringRemoves all spaces and tab characters
stripIndent(str: string, retainUnnecessaryLines?: boolean): stringNormalizes indentation by removing the minimum indent count
arrayUnique<T>(array: T[]): T[]Returns array with duplicates removed
arrayRemove<T>(array: T[], entry: T): voidRemoves specified element from array (destructive operation)
range(length: number, offset?: number): number[]Generates numeric array of specified range
flattenRecursiveArray<T>(source: RecursiveArray<T>): T[]Flattens recursive array
isPlainObject<T>(value: unknown): value is TDetermines whether value is a plain object
isObject<T>(value: unknown): value is TDetermines whether value is an instance derived from Object class
pickProperties<T, K>(obj: T, props: K[]): Pick<T, K>Extracts only specified properties
omitProperties<T, K>(obj: T, props: K[]): Omit<T, K>Excludes specified properties
mixin<T, U>(base: T, trait: U): Mixin<T, U>Generates a Proxy that mixes objects
toInt(value: string | number): numberConverts to integer value
toFloat(value: string | number): numberConverts to floating-point number
toNumber(source: any): numberNormalizes to number
isEmpty(value: any): booleanDetermines whether value is empty
notEmptyValue<T>(args: T[], defaultValue?: T): TReturns first non-empty value from array
inNonNullable<T>(value: T): value is Exclude<T, null | undefined>Determines whether value is not null or undefined
@fastkit/ts-type-utils: TypeScript type utilities (within same repository)For detailed documentation, please visit here.
MIT
FAQs
A small collection of helper implementations for processing primitive values and objects.
The npm package @fastkit/helpers receives a total of 82 weekly downloads. As such, @fastkit/helpers popularity was classified as not popular.
We found that @fastkit/helpers demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Ā It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.