all files / __root__/ inlinesource.ts

64.29% Statements 18/28
16.67% Branches 2/12
50% Functions 3/6
65.38% Lines 17/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 if (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;