UNPKG

dialplan

Version:

Write safe asterisk dialplan quickly on javascript

41 lines (34 loc) 838 B
// Generated by CoffeeScript 1.8.0 (function() { var Condition, Expression, Global, Value; Value = function(str) { return "${" + str + "}"; }; Expression = function() { var args; args = [].slice.call(arguments, 0); if (args.length !== 3) { throw new Error('Check count args'); } return '$[' + args[0] + args[1] + args[2] + ']'; }; Global = function(str) { return "__" + str; }; Condition = function() { var args, str; args = [].slice.call(arguments, 0); if (args.length < 2 || args.length > 3) { throw new Error('Check count args'); } str = args[0] + '?' + args[1]; str += args[2] ? ':' + args[2] : ''; return str; }; module.exports = { $: Value, Expression: Expression, Global: Global, Condition: Condition }; }).call(this);