"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Functional_1 = require("../../../../Class/Functional");
const Unit_1 = require("../../../../Class/Unit");
const _ids_1 = require("../../../_ids");
class TypeOf extends Functional_1.Functional {
    constructor(system) {
        super({
            i: ['a'],
            o: ['type'],
        }, {}, system, _ids_1.ID_TYPE_OF);
    }
    f({ a }, done) {
        const t = typeof a;
        switch (t) {
            case 'number':
                return done({ type: 'number' });
            case 'boolean':
                return done({ type: 'boolean' });
            case 'function':
                return done({ type: 'class' });
            case 'object':
                if (a === null) {
                    return done({ type: 'null' });
                }
                else {
                    if (a instanceof Unit_1.Unit) {
                        return done({ type: 'unit' });
                    }
                    if (Array.isArray(a)) {
                        return done({ type: 'array' });
                    }
                    return done({ type: 'object' });
                }
            case 'string':
                return done({ type: 'string' });
            case 'symbol':
                return done({ type: 'symbol' });
            case 'undefined':
                return done({ type: 'undefined' });
            default:
                return done({ type: 'undefined' });
        }
    }
}
exports.default = TypeOf;
//# sourceMappingURL=index.js.map