all files / support/ basic.ts

96.43% Statements 27/28
91.67% Branches 11/12
100% Functions 6/6
96.15% Lines 25/26
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43                                   
import * as has from './has';
 
export enum AType {
    A = 1,
    B,
    C,
    D
}
 
export class Foo {
    constructor (options: any) {
        for (let key in options) {
            (<any> this)[key] = options[key];
        }
    }
    bar: string = 'baz';
    private _args: any[] = [];
    method(...args: any[]): void {
        args.forEach((item) => {
            if (typeof item === 'object' || typeof item === 'function') {
                this._args.push(item);
            }
            else if (typeof item === 'string') {
                this._args.push(item);
            }
            else Eif (typeof item === 'number') {
                this._args.push(String(item));
            }
            else {
                this._args.push('something else');
            }
        });
    }
    ternary(value: any): string {
        return typeof value === 'object' ? 'isObject' : 'not object';
    }
    a: AType = AType.A;
}
 
let foo = new Foo({ bar: 'qat' });
 
export default foo;