@spa-tools/utilities
isRecord()
The isRecord()
function checks if a value is a valid plain object (aka Record
).
Usage
import { isRecord } from '@spa-tools/utilities';
const obj = { a: 1, b: 2, c: 3 };
console.log(isRecord(obj));
// --> true
const obj = new Object();
console.log(isRecord(obj));
// --> true
const obj = new Date();
console.log(isRecord(obj));
// --> false
Arguments
Name | Type | Required? | Description |
---|---|---|---|
value | unkown | yes | The value to check |
Returns
boolean
- If value
is a valid Record
then returns true
else returns false
.