UNPKG

cql-execution

Version:

An execution framework for the Clinical Quality Language (CQL)

75 lines (56 loc) 1.96 kB
// Generated by CoffeeScript 1.12.7 (function() { var Coalesce, Expression, IsNull, Null, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; Expression = require('./expression').Expression; module.exports.Null = Null = (function(superClass) { extend(Null, superClass); function Null(json) { Null.__super__.constructor.apply(this, arguments); } Null.prototype.exec = function(ctx) { return null; }; return Null; })(Expression); module.exports.IsNull = IsNull = (function(superClass) { extend(IsNull, superClass); function IsNull(json) { IsNull.__super__.constructor.apply(this, arguments); } IsNull.prototype.exec = function(ctx) { return this.execArgs(ctx) == null; }; return IsNull; })(Expression); module.exports.Coalesce = Coalesce = (function(superClass) { extend(Coalesce, superClass); function Coalesce(json) { Coalesce.__super__.constructor.apply(this, arguments); } Coalesce.prototype.exec = function(ctx) { var arg, i, item, j, len, len1, ref, result; ref = this.args; for (i = 0, len = ref.length; i < len; i++) { arg = ref[i]; result = arg.execute(ctx); if (this.args.length === 1 && Array.isArray(result)) { for (j = 0, len1 = result.length; j < len1; j++) { item = result[j]; if (item != null) { return item; } } } else { if (result != null) { return result; } } } return null; }; return Coalesce; })(Expression); }).call(this); //# sourceMappingURL=nullological.js.map