dropkiq
Version:
Liquid Expressions Simplified
1 lines • 1.44 kB
JavaScript
;var __read=this&&this.__read||function(r,e){var n="function"==typeof Symbol&&r[Symbol.iterator];if(!n)return r;var t,o,i=n.call(r),u=[];try{for(;(void 0===e||e-- >0)&&!(t=i.next()).done;)u.push(t.value)}catch(r){o={error:r}}finally{try{t&&!t.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return u},__spread=this&&this.__spread||function(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(__read(arguments[e]));return r};Object.defineProperty(exports,"__esModule",{value:!0});var underscore_1=require("../../util/underscore"),boolean_1=require("../../render/boolean");function map(r,e){return r.map((function(r){return r[e]}))}function concat(r,e){return Array.prototype.concat.call(r,e)}function slice(r,e,n){return void 0===n&&(n=1),e=e<0?r.length+e:e,r.slice(e,e+n)}function where(r,e,n){var t=this;return r.filter((function(r){var o=t.context.getFromScope(r,e);return void 0===n?boolean_1.isTruthy(o):o===n}))}function uniq(r){var e={};return(r||[]).filter((function(r){return!e.hasOwnProperty(String(r))&&(e[String(r)]=!0,!0)}))}exports.default={join:function(r,e){return r.join(void 0===e?" ":e)},last:function(r){return underscore_1.isArray(r)?underscore_1.last(r):""},first:function(r){return underscore_1.isArray(r)?r[0]:""},map:map,reverse:function(r){return __spread(r).reverse()},sort:function(r,e){return r.sort(e)},size:function(r){return r&&r.length||0},concat:concat,slice:slice,uniq:uniq,where:where};