@sitecore/sc-contenthub-webclient-sdk
Version:
Sitecore Content Hub WebClient SDK.
29 lines • 873 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TypeGuards = void 0;
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";
}
}
exports.TypeGuards = TypeGuards;
//# sourceMappingURL=type-guards.js.map