UNPKG

@akala/core

Version:
26 lines 1.13 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const helpers_1 = require("../helpers"); const parser_1 = require("../parser"); const global_injector_1 = require("../global-injector"); const binder_1 = require("../binder"); class CallFormatterFactory { constructor() { } parse(expression) { return new parser_1.ParsedString(expression.substring(0, parser_1.Parser.parseFunction(expression).$$length)); } build(formatter, settings) { function evaluate(x) { if (this.args && x && x[this.method]) { return x[this.method].apply(x, binder_1.Binding.unbindify(this.args)); } } if (settings.value.startsWith('$formatters.')) return helpers_1.module('$formatters').injectWithName([settings.value.substring('$formatters.'.length)], evaluate); else return global_injector_1.injectWithName([settings.value], evaluate); } } exports.CallFormatterFactory = CallFormatterFactory; helpers_1.module('$formatters').register('#call', new CallFormatterFactory()); //# sourceMappingURL=call.js.map