polygonjs-engine
Version:
node-based webgl 3D engine https://polygonjs.com
25 lines (23 loc) • 746 B
text/typescript
import {Vector2} from 'three/src/math/Vector2';
import {Vector3} from 'three/src/math/Vector3';
import {Vector4} from 'three/src/math/Vector4';
export class CoreType {
static isNumber(value: any): value is number {
return typeof value == 'number';
}
static isVector(value: any): value is Vector2 | Vector3 | Vector4 {
return value instanceof Vector2 || value instanceof Vector3 || value instanceof Vector4;
}
static isString(value: any): value is string {
return typeof value == 'string';
}
static isBoolean(value: any): value is boolean {
return value === true || value === false;
}
static isNaN(value: any): boolean {
return isNaN(value);
}
static isArray(value: any): value is any[] {
return Array.isArray(value);
}
}