Get the type of a value as a string.
import { getType } from '@aws-lambda-powertools/commons/typeUtils';const type = getType('foo'); // 'string'const otherType = getType(42); // 'number'const anotherType = getType({ key: 'value' }); // 'object'const unknownType = getType(Symbol('foo')); // 'unknown' Copy
import { getType } from '@aws-lambda-powertools/commons/typeUtils';const type = getType('foo'); // 'string'const otherType = getType(42); // 'number'const anotherType = getType({ key: 'value' }); // 'object'const unknownType = getType(Symbol('foo')); // 'unknown'
The value to check
Get the type of a value as a string.
Example