mirror of
https://github.com/harttle/liquidjs.git
synced 2026-10-03 09:05:14 -07:00
chore(release): 7.3.0 [skip ci]
# [7.3.0](https://github.com/harttle/liquidjs/compare/v7.2.2...v7.3.0) (2019-02-24)
### Features
* nil/null/empty/blank literals, resolves [#102](https://github.com/harttle/liquidjs/issues/102) ([88c9e96](https://github.com/harttle/liquidjs/commit/88c9e96))
This commit is contained in:
@@ -1,3 +1,10 @@
|
|||||||
|
# [7.3.0](https://github.com/harttle/liquidjs/compare/v7.2.2...v7.3.0) (2019-02-24)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* nil/null/empty/blank literals, resolves [#102](https://github.com/harttle/liquidjs/issues/102) ([88c9e96](https://github.com/harttle/liquidjs/commit/88c9e96))
|
||||||
|
|
||||||
## [7.2.2](https://github.com/harttle/liquidjs/compare/v7.2.1...v7.2.2) (2019-02-23)
|
## [7.2.2](https://github.com/harttle/liquidjs/compare/v7.2.1...v7.2.2) (2019-02-23)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Vendored
+155
-18
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* liquidjs@7.2.2, https://github.com/harttle/liquidjs
|
* liquidjs@7.3.0, https://github.com/harttle/liquidjs
|
||||||
* (c) 2016-2019 harttle
|
* (c) 2016-2019 harttle
|
||||||
* Released under the MIT License.
|
* Released under the MIT License.
|
||||||
*/
|
*/
|
||||||
@@ -418,7 +418,7 @@ var Scope = /** @class */ (function () {
|
|||||||
Scope.prototype.readProperty = function (obj, key) {
|
Scope.prototype.readProperty = function (obj, key) {
|
||||||
var val;
|
var val;
|
||||||
if (isNil(obj)) {
|
if (isNil(obj)) {
|
||||||
val = undefined;
|
val = obj;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
obj = toLiquid(obj);
|
obj = toLiquid(obj);
|
||||||
@@ -840,13 +840,136 @@ var Render = /** @class */ (function () {
|
|||||||
return Render;
|
return Render;
|
||||||
}());
|
}());
|
||||||
|
|
||||||
var operators$1 = {
|
function isComparable(arg) {
|
||||||
'==': function (l, r) { return l === r; },
|
return arg && isFunction(arg.equals);
|
||||||
'!=': function (l, r) { return l !== r; },
|
}
|
||||||
'>': function (l, r) { return l !== null && r !== null && l > r; },
|
|
||||||
'<': function (l, r) { return l !== null && r !== null && l < r; },
|
var Drop = /** @class */ (function () {
|
||||||
'>=': function (l, r) { return l !== null && r !== null && l >= r; },
|
function Drop() {
|
||||||
'<=': function (l, r) { return l !== null && r !== null && l <= r; },
|
}
|
||||||
|
return Drop;
|
||||||
|
}());
|
||||||
|
|
||||||
|
function isDrop(value) {
|
||||||
|
return value instanceof Drop && isFunction(value.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
var EmptyDrop = /** @class */ (function (_super) {
|
||||||
|
__extends(EmptyDrop, _super);
|
||||||
|
function EmptyDrop() {
|
||||||
|
return _super !== null && _super.apply(this, arguments) || this;
|
||||||
|
}
|
||||||
|
EmptyDrop.prototype.equals = function (value) {
|
||||||
|
if (isString(value) || isArray(value))
|
||||||
|
return value.length === 0;
|
||||||
|
if (isObject(value))
|
||||||
|
return Object.keys(value).length === 0;
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
EmptyDrop.prototype.gt = function () {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
EmptyDrop.prototype.geq = function () {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
EmptyDrop.prototype.lt = function () {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
EmptyDrop.prototype.leq = function () {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
EmptyDrop.prototype.value = function () {
|
||||||
|
return '';
|
||||||
|
};
|
||||||
|
return EmptyDrop;
|
||||||
|
}(Drop));
|
||||||
|
|
||||||
|
var BlankDrop = /** @class */ (function (_super) {
|
||||||
|
__extends(BlankDrop, _super);
|
||||||
|
function BlankDrop() {
|
||||||
|
return _super !== null && _super.apply(this, arguments) || this;
|
||||||
|
}
|
||||||
|
BlankDrop.prototype.equals = function (value) {
|
||||||
|
if (value === false)
|
||||||
|
return true;
|
||||||
|
if (isNil(isDrop(value) ? value.value() : value))
|
||||||
|
return true;
|
||||||
|
if (isString(value))
|
||||||
|
return /^\s*$/.test(value);
|
||||||
|
return _super.prototype.equals.call(this, value);
|
||||||
|
};
|
||||||
|
return BlankDrop;
|
||||||
|
}(EmptyDrop));
|
||||||
|
|
||||||
|
var NullDrop = /** @class */ (function (_super) {
|
||||||
|
__extends(NullDrop, _super);
|
||||||
|
function NullDrop() {
|
||||||
|
return _super !== null && _super.apply(this, arguments) || this;
|
||||||
|
}
|
||||||
|
NullDrop.prototype.equals = function (value) {
|
||||||
|
return isNil(isDrop(value) ? value.value() : value) || value instanceof BlankDrop;
|
||||||
|
};
|
||||||
|
NullDrop.prototype.gt = function () {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
NullDrop.prototype.geq = function () {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
NullDrop.prototype.lt = function () {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
NullDrop.prototype.leq = function () {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
NullDrop.prototype.value = function () {
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
return NullDrop;
|
||||||
|
}(Drop));
|
||||||
|
|
||||||
|
var binaryOperators = {
|
||||||
|
'==': function (l, r) {
|
||||||
|
if (isComparable(l))
|
||||||
|
return l.equals(r);
|
||||||
|
if (isComparable(r))
|
||||||
|
return r.equals(l);
|
||||||
|
return l === r;
|
||||||
|
},
|
||||||
|
'!=': function (l, r) {
|
||||||
|
if (isComparable(l))
|
||||||
|
return !l.equals(r);
|
||||||
|
if (isComparable(r))
|
||||||
|
return !r.equals(l);
|
||||||
|
return l !== r;
|
||||||
|
},
|
||||||
|
'>': function (l, r) {
|
||||||
|
if (isComparable(l))
|
||||||
|
return l.gt(r);
|
||||||
|
if (isComparable(r))
|
||||||
|
return r.lt(l);
|
||||||
|
return l > r;
|
||||||
|
},
|
||||||
|
'<': function (l, r) {
|
||||||
|
if (isComparable(l))
|
||||||
|
return l.lt(r);
|
||||||
|
if (isComparable(r))
|
||||||
|
return r.gt(l);
|
||||||
|
return l < r;
|
||||||
|
},
|
||||||
|
'>=': function (l, r) {
|
||||||
|
if (isComparable(l))
|
||||||
|
return l.geq(r);
|
||||||
|
if (isComparable(r))
|
||||||
|
return r.leq(l);
|
||||||
|
return l >= r;
|
||||||
|
},
|
||||||
|
'<=': function (l, r) {
|
||||||
|
if (isComparable(l))
|
||||||
|
return l.leq(r);
|
||||||
|
if (isComparable(r))
|
||||||
|
return r.geq(l);
|
||||||
|
return l <= r;
|
||||||
|
},
|
||||||
'contains': function (l, r) {
|
'contains': function (l, r) {
|
||||||
if (!l)
|
if (!l)
|
||||||
return false;
|
return false;
|
||||||
@@ -857,28 +980,32 @@ var operators$1 = {
|
|||||||
'and': function (l, r) { return isTruthy(l) && isTruthy(r); },
|
'and': function (l, r) { return isTruthy(l) && isTruthy(r); },
|
||||||
'or': function (l, r) { return isTruthy(l) || isTruthy(r); }
|
'or': function (l, r) { return isTruthy(l) || isTruthy(r); }
|
||||||
};
|
};
|
||||||
function evalExp(exp, scope) {
|
function parseExp(exp, scope) {
|
||||||
assert(scope, 'unable to evalExp: scope undefined');
|
assert(scope, 'unable to parseExp: scope undefined');
|
||||||
var operatorREs = operators;
|
var operatorREs = operators;
|
||||||
var match;
|
var match;
|
||||||
for (var i = 0; i < operatorREs.length; i++) {
|
for (var i = 0; i < operatorREs.length; i++) {
|
||||||
var operatorRE = operatorREs[i];
|
var operatorRE = operatorREs[i];
|
||||||
var expRE = new RegExp("^(" + quoteBalanced.source + ")(" + operatorRE.source + ")(" + quoteBalanced.source + ")$");
|
var expRE = new RegExp("^(" + quoteBalanced.source + ")(" + operatorRE.source + ")(" + quoteBalanced.source + ")$");
|
||||||
if ((match = exp.match(expRE))) {
|
if ((match = exp.match(expRE))) {
|
||||||
var l = evalExp(match[1], scope);
|
var l = parseExp(match[1], scope);
|
||||||
var op = operators$1[match[2].trim()];
|
var op = binaryOperators[match[2].trim()];
|
||||||
var r = evalExp(match[3], scope);
|
var r = parseExp(match[3], scope);
|
||||||
return op(l, r);
|
return op(l, r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((match = exp.match(rangeLine))) {
|
if ((match = exp.match(rangeLine))) {
|
||||||
var low = evalValue(match[1], scope);
|
var low = parseValue(match[1], scope);
|
||||||
var high = evalValue(match[2], scope);
|
var high = parseValue(match[2], scope);
|
||||||
return range(low, high + 1);
|
return range(low, high + 1);
|
||||||
}
|
}
|
||||||
return evalValue(exp, scope);
|
return parseValue(exp, scope);
|
||||||
}
|
}
|
||||||
function evalValue(str, scope) {
|
function evalExp(str, scope) {
|
||||||
|
var value$$1 = parseExp(str, scope);
|
||||||
|
return isDrop(value$$1) ? value$$1.value() : value$$1;
|
||||||
|
}
|
||||||
|
function parseValue(str, scope) {
|
||||||
if (!str)
|
if (!str)
|
||||||
return null;
|
return null;
|
||||||
str = str.trim();
|
str = str.trim();
|
||||||
@@ -886,12 +1013,22 @@ function evalValue(str, scope) {
|
|||||||
return true;
|
return true;
|
||||||
if (str === 'false')
|
if (str === 'false')
|
||||||
return false;
|
return false;
|
||||||
|
if (str === 'nil' || str === 'null')
|
||||||
|
return new NullDrop();
|
||||||
|
if (str === 'empty')
|
||||||
|
return new EmptyDrop();
|
||||||
|
if (str === 'blank')
|
||||||
|
return new BlankDrop();
|
||||||
if (!isNaN(Number(str)))
|
if (!isNaN(Number(str)))
|
||||||
return Number(str);
|
return Number(str);
|
||||||
if ((str[0] === '"' || str[0] === "'") && str[0] === last(str))
|
if ((str[0] === '"' || str[0] === "'") && str[0] === last(str))
|
||||||
return str.slice(1, -1);
|
return str.slice(1, -1);
|
||||||
return scope.get(str);
|
return scope.get(str);
|
||||||
}
|
}
|
||||||
|
function evalValue(str, scope) {
|
||||||
|
var value$$1 = parseValue(str, scope);
|
||||||
|
return isDrop(value$$1) ? value$$1.value() : value$$1;
|
||||||
|
}
|
||||||
function isTruthy(val) {
|
function isTruthy(val) {
|
||||||
return !isFalsy(val);
|
return !isFalsy(val);
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+155
-18
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* liquidjs@7.2.2, https://github.com/harttle/liquidjs
|
* liquidjs@7.3.0, https://github.com/harttle/liquidjs
|
||||||
* (c) 2016-2019 harttle
|
* (c) 2016-2019 harttle
|
||||||
* Released under the MIT License.
|
* Released under the MIT License.
|
||||||
*/
|
*/
|
||||||
@@ -406,7 +406,7 @@
|
|||||||
Scope.prototype.readProperty = function (obj, key) {
|
Scope.prototype.readProperty = function (obj, key) {
|
||||||
var val;
|
var val;
|
||||||
if (isNil(obj)) {
|
if (isNil(obj)) {
|
||||||
val = undefined;
|
val = obj;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
obj = toLiquid(obj);
|
obj = toLiquid(obj);
|
||||||
@@ -865,13 +865,136 @@
|
|||||||
return Render;
|
return Render;
|
||||||
}());
|
}());
|
||||||
|
|
||||||
var operators$1 = {
|
function isComparable(arg) {
|
||||||
'==': function (l, r) { return l === r; },
|
return arg && isFunction(arg.equals);
|
||||||
'!=': function (l, r) { return l !== r; },
|
}
|
||||||
'>': function (l, r) { return l !== null && r !== null && l > r; },
|
|
||||||
'<': function (l, r) { return l !== null && r !== null && l < r; },
|
var Drop = /** @class */ (function () {
|
||||||
'>=': function (l, r) { return l !== null && r !== null && l >= r; },
|
function Drop() {
|
||||||
'<=': function (l, r) { return l !== null && r !== null && l <= r; },
|
}
|
||||||
|
return Drop;
|
||||||
|
}());
|
||||||
|
|
||||||
|
function isDrop(value) {
|
||||||
|
return value instanceof Drop && isFunction(value.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
var EmptyDrop = /** @class */ (function (_super) {
|
||||||
|
__extends(EmptyDrop, _super);
|
||||||
|
function EmptyDrop() {
|
||||||
|
return _super !== null && _super.apply(this, arguments) || this;
|
||||||
|
}
|
||||||
|
EmptyDrop.prototype.equals = function (value) {
|
||||||
|
if (isString(value) || isArray(value))
|
||||||
|
return value.length === 0;
|
||||||
|
if (isObject(value))
|
||||||
|
return Object.keys(value).length === 0;
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
EmptyDrop.prototype.gt = function () {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
EmptyDrop.prototype.geq = function () {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
EmptyDrop.prototype.lt = function () {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
EmptyDrop.prototype.leq = function () {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
EmptyDrop.prototype.value = function () {
|
||||||
|
return '';
|
||||||
|
};
|
||||||
|
return EmptyDrop;
|
||||||
|
}(Drop));
|
||||||
|
|
||||||
|
var BlankDrop = /** @class */ (function (_super) {
|
||||||
|
__extends(BlankDrop, _super);
|
||||||
|
function BlankDrop() {
|
||||||
|
return _super !== null && _super.apply(this, arguments) || this;
|
||||||
|
}
|
||||||
|
BlankDrop.prototype.equals = function (value) {
|
||||||
|
if (value === false)
|
||||||
|
return true;
|
||||||
|
if (isNil(isDrop(value) ? value.value() : value))
|
||||||
|
return true;
|
||||||
|
if (isString(value))
|
||||||
|
return /^\s*$/.test(value);
|
||||||
|
return _super.prototype.equals.call(this, value);
|
||||||
|
};
|
||||||
|
return BlankDrop;
|
||||||
|
}(EmptyDrop));
|
||||||
|
|
||||||
|
var NullDrop = /** @class */ (function (_super) {
|
||||||
|
__extends(NullDrop, _super);
|
||||||
|
function NullDrop() {
|
||||||
|
return _super !== null && _super.apply(this, arguments) || this;
|
||||||
|
}
|
||||||
|
NullDrop.prototype.equals = function (value) {
|
||||||
|
return isNil(isDrop(value) ? value.value() : value) || value instanceof BlankDrop;
|
||||||
|
};
|
||||||
|
NullDrop.prototype.gt = function () {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
NullDrop.prototype.geq = function () {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
NullDrop.prototype.lt = function () {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
NullDrop.prototype.leq = function () {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
NullDrop.prototype.value = function () {
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
return NullDrop;
|
||||||
|
}(Drop));
|
||||||
|
|
||||||
|
var binaryOperators = {
|
||||||
|
'==': function (l, r) {
|
||||||
|
if (isComparable(l))
|
||||||
|
return l.equals(r);
|
||||||
|
if (isComparable(r))
|
||||||
|
return r.equals(l);
|
||||||
|
return l === r;
|
||||||
|
},
|
||||||
|
'!=': function (l, r) {
|
||||||
|
if (isComparable(l))
|
||||||
|
return !l.equals(r);
|
||||||
|
if (isComparable(r))
|
||||||
|
return !r.equals(l);
|
||||||
|
return l !== r;
|
||||||
|
},
|
||||||
|
'>': function (l, r) {
|
||||||
|
if (isComparable(l))
|
||||||
|
return l.gt(r);
|
||||||
|
if (isComparable(r))
|
||||||
|
return r.lt(l);
|
||||||
|
return l > r;
|
||||||
|
},
|
||||||
|
'<': function (l, r) {
|
||||||
|
if (isComparable(l))
|
||||||
|
return l.lt(r);
|
||||||
|
if (isComparable(r))
|
||||||
|
return r.gt(l);
|
||||||
|
return l < r;
|
||||||
|
},
|
||||||
|
'>=': function (l, r) {
|
||||||
|
if (isComparable(l))
|
||||||
|
return l.geq(r);
|
||||||
|
if (isComparable(r))
|
||||||
|
return r.leq(l);
|
||||||
|
return l >= r;
|
||||||
|
},
|
||||||
|
'<=': function (l, r) {
|
||||||
|
if (isComparable(l))
|
||||||
|
return l.leq(r);
|
||||||
|
if (isComparable(r))
|
||||||
|
return r.geq(l);
|
||||||
|
return l <= r;
|
||||||
|
},
|
||||||
'contains': function (l, r) {
|
'contains': function (l, r) {
|
||||||
if (!l)
|
if (!l)
|
||||||
return false;
|
return false;
|
||||||
@@ -882,28 +1005,32 @@
|
|||||||
'and': function (l, r) { return isTruthy(l) && isTruthy(r); },
|
'and': function (l, r) { return isTruthy(l) && isTruthy(r); },
|
||||||
'or': function (l, r) { return isTruthy(l) || isTruthy(r); }
|
'or': function (l, r) { return isTruthy(l) || isTruthy(r); }
|
||||||
};
|
};
|
||||||
function evalExp(exp, scope) {
|
function parseExp(exp, scope) {
|
||||||
assert(scope, 'unable to evalExp: scope undefined');
|
assert(scope, 'unable to parseExp: scope undefined');
|
||||||
var operatorREs = operators;
|
var operatorREs = operators;
|
||||||
var match;
|
var match;
|
||||||
for (var i = 0; i < operatorREs.length; i++) {
|
for (var i = 0; i < operatorREs.length; i++) {
|
||||||
var operatorRE = operatorREs[i];
|
var operatorRE = operatorREs[i];
|
||||||
var expRE = new RegExp("^(" + quoteBalanced.source + ")(" + operatorRE.source + ")(" + quoteBalanced.source + ")$");
|
var expRE = new RegExp("^(" + quoteBalanced.source + ")(" + operatorRE.source + ")(" + quoteBalanced.source + ")$");
|
||||||
if ((match = exp.match(expRE))) {
|
if ((match = exp.match(expRE))) {
|
||||||
var l = evalExp(match[1], scope);
|
var l = parseExp(match[1], scope);
|
||||||
var op = operators$1[match[2].trim()];
|
var op = binaryOperators[match[2].trim()];
|
||||||
var r = evalExp(match[3], scope);
|
var r = parseExp(match[3], scope);
|
||||||
return op(l, r);
|
return op(l, r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((match = exp.match(rangeLine))) {
|
if ((match = exp.match(rangeLine))) {
|
||||||
var low = evalValue(match[1], scope);
|
var low = parseValue(match[1], scope);
|
||||||
var high = evalValue(match[2], scope);
|
var high = parseValue(match[2], scope);
|
||||||
return range(low, high + 1);
|
return range(low, high + 1);
|
||||||
}
|
}
|
||||||
return evalValue(exp, scope);
|
return parseValue(exp, scope);
|
||||||
}
|
}
|
||||||
function evalValue(str, scope) {
|
function evalExp(str, scope) {
|
||||||
|
var value$$1 = parseExp(str, scope);
|
||||||
|
return isDrop(value$$1) ? value$$1.value() : value$$1;
|
||||||
|
}
|
||||||
|
function parseValue(str, scope) {
|
||||||
if (!str)
|
if (!str)
|
||||||
return null;
|
return null;
|
||||||
str = str.trim();
|
str = str.trim();
|
||||||
@@ -911,12 +1038,22 @@
|
|||||||
return true;
|
return true;
|
||||||
if (str === 'false')
|
if (str === 'false')
|
||||||
return false;
|
return false;
|
||||||
|
if (str === 'nil' || str === 'null')
|
||||||
|
return new NullDrop();
|
||||||
|
if (str === 'empty')
|
||||||
|
return new EmptyDrop();
|
||||||
|
if (str === 'blank')
|
||||||
|
return new BlankDrop();
|
||||||
if (!isNaN(Number(str)))
|
if (!isNaN(Number(str)))
|
||||||
return Number(str);
|
return Number(str);
|
||||||
if ((str[0] === '"' || str[0] === "'") && str[0] === last(str))
|
if ((str[0] === '"' || str[0] === "'") && str[0] === last(str))
|
||||||
return str.slice(1, -1);
|
return str.slice(1, -1);
|
||||||
return scope.get(str);
|
return scope.get(str);
|
||||||
}
|
}
|
||||||
|
function evalValue(str, scope) {
|
||||||
|
var value$$1 = parseValue(str, scope);
|
||||||
|
return isDrop(value$$1) ? value$$1.value() : value$$1;
|
||||||
|
}
|
||||||
function isTruthy(val) {
|
function isTruthy(val) {
|
||||||
return !isFalsy(val);
|
return !isFalsy(val);
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+4
@@ -0,0 +1,4 @@
|
|||||||
|
import { EmptyDrop } from 'src/drop/empty-drop';
|
||||||
|
export declare class BlankDrop extends EmptyDrop {
|
||||||
|
equals(value: any): boolean;
|
||||||
|
}
|
||||||
Vendored
+2
@@ -0,0 +1,2 @@
|
|||||||
|
export declare abstract class Drop {
|
||||||
|
}
|
||||||
Vendored
+11
@@ -0,0 +1,11 @@
|
|||||||
|
import { Drop } from './drop';
|
||||||
|
import { IComparable } from './icomparable';
|
||||||
|
import { IDrop } from 'src/drop/idrop';
|
||||||
|
export declare class EmptyDrop extends Drop implements IDrop, IComparable {
|
||||||
|
equals(value: any): boolean;
|
||||||
|
gt(): boolean;
|
||||||
|
geq(): boolean;
|
||||||
|
lt(): boolean;
|
||||||
|
leq(): boolean;
|
||||||
|
value(): string;
|
||||||
|
}
|
||||||
Vendored
+8
@@ -0,0 +1,8 @@
|
|||||||
|
export interface IComparable {
|
||||||
|
equals: (rhs: any) => boolean;
|
||||||
|
gt: (rhs: any) => boolean;
|
||||||
|
geq: (rhs: any) => boolean;
|
||||||
|
lt: (rhs: any) => boolean;
|
||||||
|
leq: (rhs: any) => boolean;
|
||||||
|
}
|
||||||
|
export declare function isComparable(arg: any): arg is IComparable;
|
||||||
Vendored
+4
@@ -0,0 +1,4 @@
|
|||||||
|
export interface IDrop {
|
||||||
|
value(): any;
|
||||||
|
}
|
||||||
|
export declare function isDrop(value: any): value is IDrop;
|
||||||
Vendored
+11
@@ -0,0 +1,11 @@
|
|||||||
|
import { Drop } from './drop';
|
||||||
|
import { IComparable } from './icomparable';
|
||||||
|
import { IDrop } from 'src/drop/idrop';
|
||||||
|
export declare class NullDrop extends Drop implements IDrop, IComparable {
|
||||||
|
equals(value: any): boolean;
|
||||||
|
gt(): boolean;
|
||||||
|
geq(): boolean;
|
||||||
|
lt(): boolean;
|
||||||
|
leq(): boolean;
|
||||||
|
value(): null;
|
||||||
|
}
|
||||||
Vendored
+2
-1
@@ -1,5 +1,6 @@
|
|||||||
import Scope from 'src/scope/scope';
|
import Scope from 'src/scope/scope';
|
||||||
export declare function evalExp(exp: string, scope: Scope): any;
|
export declare function parseExp(exp: string, scope: Scope): any;
|
||||||
|
export declare function evalExp(str: string, scope: Scope): any;
|
||||||
export declare function evalValue(str: string, scope: Scope): any;
|
export declare function evalValue(str: string, scope: Scope): any;
|
||||||
export declare function isTruthy(val: any): boolean;
|
export declare function isTruthy(val: any): boolean;
|
||||||
export declare function isFalsy(val: any): boolean;
|
export declare function isFalsy(val: any): boolean;
|
||||||
|
|||||||
Vendored
+9
-4
@@ -1,22 +1,27 @@
|
|||||||
import { NormalizedFullOptions } from '../liquid-options';
|
import { NormalizedFullOptions } from '../liquid-options';
|
||||||
import BlockMode from './block-mode';
|
import BlockMode from './block-mode';
|
||||||
import IContext from './icontext';
|
export declare type Context = {
|
||||||
|
[key: string]: any;
|
||||||
|
liquid_method_missing?: (key: string) => any;
|
||||||
|
to_liquid?: () => any;
|
||||||
|
toLiquid?: () => any;
|
||||||
|
};
|
||||||
export default class Scope {
|
export default class Scope {
|
||||||
opts: NormalizedFullOptions;
|
opts: NormalizedFullOptions;
|
||||||
contexts: Array<IContext>;
|
contexts: Array<Context>;
|
||||||
blocks: object;
|
blocks: object;
|
||||||
groups: {
|
groups: {
|
||||||
[key: string]: number;
|
[key: string]: number;
|
||||||
};
|
};
|
||||||
blockMode: BlockMode;
|
blockMode: BlockMode;
|
||||||
constructor(ctx?: object, opts?: NormalizedFullOptions);
|
constructor(ctx?: object, opts?: NormalizedFullOptions);
|
||||||
getAll(): IContext;
|
getAll(): Context;
|
||||||
get(path: string): any;
|
get(path: string): any;
|
||||||
set(path: string, v: any): void;
|
set(path: string, v: any): void;
|
||||||
unshift(ctx: object): number;
|
unshift(ctx: object): number;
|
||||||
push(ctx: object): number;
|
push(ctx: object): number;
|
||||||
pop(ctx?: object): object | undefined;
|
pop(ctx?: object): object | undefined;
|
||||||
findContextFor(key: string, filter?: ((conttext: object) => boolean)): IContext | null;
|
findContextFor(key: string, filter?: ((conttext: object) => boolean)): Context | null;
|
||||||
private readProperty;
|
private readProperty;
|
||||||
propertyAccessSeq(str: string): string[];
|
propertyAccessSeq(str: string): string[];
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+5
-5
@@ -1,12 +1,12 @@
|
|||||||
export declare function isString(value: any): boolean;
|
export declare function isString(value: any): value is string;
|
||||||
export declare function isFunction(value: any): boolean;
|
export declare function isFunction(value: any): value is Function;
|
||||||
export declare function promisify<T1, T2>(fn: (arg1: T1, cb: (err: Error | null, result: T2) => void) => void): (arg1: T1) => Promise<T2>;
|
export declare function promisify<T1, T2>(fn: (arg1: T1, cb: (err: Error | null, result: T2) => void) => void): (arg1: T1) => Promise<T2>;
|
||||||
export declare function promisify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, cb: (err: Error | null, result: T3) => void) => void): (arg1: T1, arg2: T2) => Promise<T3>;
|
export declare function promisify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, cb: (err: Error | null, result: T3) => void) => void): (arg1: T1, arg2: T2) => Promise<T3>;
|
||||||
export declare function stringify(value: any): string;
|
export declare function stringify(value: any): string;
|
||||||
export declare function create<T1 extends object, T2 extends T1 = T1>(proto: T1): T2;
|
export declare function create<T1 extends object, T2 extends T1 = T1>(proto: T1): T2;
|
||||||
export declare function isNil(value: any): boolean;
|
export declare function isNil(value: any): boolean;
|
||||||
export declare function isArray(value: any): boolean;
|
export declare function isArray(value: any): value is any[];
|
||||||
export declare function isError(value: any): boolean;
|
export declare function isError(value: any): value is Error;
|
||||||
export declare function forOwn<T>(object: {
|
export declare function forOwn<T>(object: {
|
||||||
[key: string]: T;
|
[key: string]: T;
|
||||||
} | undefined, iteratee: ((val: T, key: string, obj: {
|
} | undefined, iteratee: ((val: T, key: string, obj: {
|
||||||
@@ -16,6 +16,6 @@ export declare function forOwn<T>(object: {
|
|||||||
};
|
};
|
||||||
export declare function last<T>(arr: T[]): T;
|
export declare function last<T>(arr: T[]): T;
|
||||||
export declare function last(arr: string): string;
|
export declare function last(arr: string): string;
|
||||||
export declare function isObject(value: any): boolean;
|
export declare function isObject(value: any): value is object;
|
||||||
export declare function range(start: number, stop?: number, step?: number): number[];
|
export declare function range(start: number, stop?: number, step?: number): number[];
|
||||||
export declare function padStart(str: any, length: number, ch?: string): any;
|
export declare function padStart(str: any, length: number, ch?: string): any;
|
||||||
|
|||||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "liquidjs",
|
"name": "liquidjs",
|
||||||
"version": "7.2.2",
|
"version": "7.3.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "liquidjs",
|
"name": "liquidjs",
|
||||||
"version": "7.2.2",
|
"version": "7.3.0",
|
||||||
"description": "Liquid template engine by pure JavaScript: compatible to shopify, easy to extend.",
|
"description": "Liquid template engine by pure JavaScript: compatible to shopify, easy to extend.",
|
||||||
"main": "dist/liquid.common.js",
|
"main": "dist/liquid.common.js",
|
||||||
"types": "dist/liquid.d.ts",
|
"types": "dist/liquid.d.ts",
|
||||||
|
|||||||
Reference in New Issue
Block a user