typescriptkit
Version:
Basic functionality for TypeScript projects
46 lines (37 loc) • 1.48 kB
text/typescript
import { ObjectExtensions } from '../Extensions/ObjectExtensions';
/**
* Helper Utility for system types
*/
export class SystemTypeHelper {
/**
* Check whether an object is an array
* @param object The object to check whether it it's an array
*/
public static isArray = (object: any): boolean => object instanceof Array;
/**
* Check whether an object is an object
* @param object The object to check whether it it's an object
*/
public static isObject = (object: any): boolean => object instanceof Object;
/**
* Check whether an object is a string
* @param object The object to check whether it it's an object
*/
public static isString = (object: any): boolean => typeof(object) === typeof(String());
/**
* Check whether an object is a function
* @param object The object to check whether it it's a function
*/
public static isFunction = (object: any): boolean => typeof(object) === typeof(Function());
/**
* Check whether an object is a numeric value
* @param object The object to check whether it it's a number
*/
public static isNumber = (object: any): boolean => typeof(object) === typeof(0);
/**
* Check whether an object is a boolean value
* @param object The object to check whether it it's a boolean
*/
public static isBoolean = (object: any): boolean => typeof(object) === typeof(true);
}
export default SystemTypeHelper;