UNPKG

superfly-timeline

Version:

Resolver for defining objects with temporal boolean logic relationships on a timeline

28 lines 884 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isNumericExpr = exports.isConstantExpr = void 0; /** Returns true if an expression is a constant (ie doesn't reference something else) */ function isConstantExpr(str) { if (isNumericExpr(str)) return true; if (typeof str === 'string') { const lStr = str.toLowerCase(); if (lStr === 'true') return true; if (lStr === 'false') return true; } return false; } exports.isConstantExpr = isConstantExpr; function isNumericExpr(str) { if (str === null) return false; if (typeof str === 'number') return true; if (typeof str === 'string') return !!/^[-+]?[0-9.]+$/.exec(str) && !isNaN(parseFloat(str)); return false; } exports.isNumericExpr = isNumericExpr; //# sourceMappingURL=expression.js.map