@sitecore/sc-contenthub-webclient-sdk
Version:
Sitecore Content Hub WebClient SDK.
25 lines • 741 B
JavaScript
export class TypeGuards {
/**
* A naive type guard to check if we are dealing with a string array.
*
* @remarks
* Only checks if the first element of the array is of type "string".
*
* @param obj - An array
*/
static isStringArray(obj) {
return obj != null && obj.length > 0 && typeof obj[0] === "string";
}
/**
* A naive type guard to check if we are dealing with a number array.
*
* @remarks
* Only checks if the first element of the array is of type "number".
*
* @param obj - An array
*/
static isNumberArray(obj) {
return obj != null && obj.length > 0 && typeof obj[0] === "number";
}
}
//# sourceMappingURL=type-guards.js.map