Static
assertStatic
buildStatic
entriesType-safe Object.entries() with overload for NonEmptyArray
The object shape
The object shape to get the values from
Array of tuples with key and value
const result1: NonEmptyReadonlyArray<['key', 'value']> = RecordCore.entries({key: 'value'} as const);
const result2: Array<['key', string]> = RecordCore.entries({key: 'value'});
const result3: Array<[string, string]> = RecordCore.entries<Record<string, string>>({key: 'value'});
const result4: [] = RecordCore.entries({});
Static
isStatic
isStatic
keysType-safe Object.keys() with overload for NonEmptyArray
The object shape
The object shape to get the values from
Array of object keys
Static
omitOmit function to omit keys from an object or use as map function to omit keys from an array
Omit keys
Object type
omitted object or map function
type Data = {demo: string, value: number|null};
const data: Data = {demo: 'hello', value: null};
const output: Omit<Data, 'value'> = RecordCore.omit(['value'], data);
const dataArray: Data[] = [{demo: 'hello', value: null}];
const output: Omit<Data, 'demo'>[] = dataArray.map(RecordCore.omit(['demo']));
Omit function to omit keys from an object or use as map function to omit keys from an array
Omit keys
to omit
omitted object or map function
type Data = {demo: string, value: number|null};
const data: Data = {demo: 'hello', value: null};
const output: Omit<Data, 'value'> = RecordCore.omit(['value'], data);
const dataArray: Data[] = [{demo: 'hello', value: null}];
const output: Omit<Data, 'demo'>[] = dataArray.map(RecordCore.omit(['demo']));
Static
onCreates a function that selects a specific property value from an object.
Useful for use with arrays map
function when extracting a single property from each object.
Object target from which the property will be selected
Property name in target that will be selected
The property name to select
select value by key from the target
Creates a function that selects a specific property value from an object.
Useful for use with arrays map
function when extracting a single property from each object.
Property name in target that will be selected
The property name to select
select value by key from the target
Static
onCreates a predicate function that checks whether a given object's property equals the specified value.
Supports both strictly typed object structures and looser records with optional properties.
Useful for filtering arrays of objects based on property values.
The object type with known keys (strict overload).
The key of the property to compare.
A predicate for use with arrays of type T.
Creates a predicate function that checks whether a given object's property equals the specified value.
Supports both strictly typed object structures and looser records with optional properties.
Useful for filtering arrays of objects based on property values.
The value type of the property (loose overload).
The key of the property to compare.
A predicate for use with arrays of type T.
Static
onCreates a predicate function that checks whether a given object's property does not equal the specified value.
Supports both strictly typed object structures and looser records with optional properties.
Useful for filtering arrays of objects where you want to exclude items with a certain property value.
The object type with known keys (strict overload).
The key of the property to compare.
A predicate function returning true when obj[key] !== value
.
// Strict object structure
const isNotAdmin = RecordCore.onKeyNotEqual<User, 'role'>('role', 'admin');
const nonAdmins = users.filter(isNotAdmin);
Creates a predicate function that checks whether a given object's property does not equal the specified value.
Supports both strictly typed object structures and looser records with optional properties.
Useful for filtering arrays of objects where you want to exclude items with a certain property value.
The value type of the property (loose overload).
The key of the property to compare.
A predicate function returning true when obj[key] !== value
.
// Strict object structure
const isNotAdmin = RecordCore.onKeyNotEqual<User, 'role'>('role', 'admin');
const nonAdmins = users.filter(isNotAdmin);
Static
pickPick function to pick keys from an object or use as map function to pick keys from an array
Pick keys
Object type
picked object or map function
type Data = {demo: string, value: number|null};
const data: Data = {demo: 'hello', value: null};
const output: Pick<Data, 'value'> = RecordCore.pick(['value'], data);
const dataArray: Data[] = [{demo: 'hello', value: null}];
const output: Pick<Data, 'demo'>[] = dataArray.map(RecordCore.pick(['demo']));
Pick function to pick keys from an object or use as map function to pick keys from an array
Pick keys
keys to pick
picked object or map function
type Data = {demo: string, value: number|null};
const data: Data = {demo: 'hello', value: null};
const output: Pick<Data, 'value'> = RecordCore.pick(['value'], data);
const dataArray: Data[] = [{demo: 'hello', value: null}];
const output: Pick<Data, 'demo'>[] = dataArray.map(RecordCore.pick(['demo']));
Static
valuesType-safe Object.values() with overload for NonEmptyArray
The object shape
The object shape to get the values from
Array of object values
The core Object functions
Since
v1.0.0