New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

handlebars-helper

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

handlebars-helper - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

6

handlebars_helper.js

@@ -1,4 +0,4 @@

/* Handlebars Helper v0.0.7
Generated on 2013-12-18 at 15:30:03 */
/* Handlebars Helper v0.0.8
Generated on 2014-01-17 at 15:24:27 */
!function(a){if("function"==typeof bootstrap)bootstrap("handlebars_helper",a);else if("object"==typeof exports)module.exports=a();else if("function"==typeof define&&define.amd)define(a);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeHandlebarshelper=a}else"undefined"!=typeof window?window.handlebarshelper=a():global.handlebarshelper=a()}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b){b.exports=a("./lib")},{"./lib":22}],2:[function(a,b){var c=a("new-date"),d=31536e3,e=2592e3,f=86400,g=3600;b.exports=function(a){a=c(a);var b=Math.floor((new Date-a)/1e3),h=Math.floor(b/d);return h>1?h+" years ago":(h=Math.floor(b/e),h>1?h+" months ago":(h=Math.floor(b/f),h>1?h+" days ago":(h=Math.floor(b/g),h>1?h+" hours ago":(h=Math.floor(b/60),h>1?h+" minutes ago":Math.floor(b)<=1?"Just now":Math.floor(b)+" seconds ago"))))}},{"new-date":23}],3:[function(a,b){b.exports=function(a,b,c,d){if(d=d||c,"number"==typeof b){c="number"!=typeof c?void 0:c>0?c+1:c,a=a.slice(b,c);for(var e="",f=0;f<a.length;f++)e+=d.fn(a[f]);return e}}},{}],4:[function(a,b){b.exports=function(a,b,c){if("string"==typeof a)return a.search(b)>=0?c.fn():c.inverse();for(var d in a)if(a.hasOwnProperty(d)&&a[d]==b)return c.fn();return c.inverse()}},{}],5:[function(a,b){b.exports=function(a){return encodeURIComponent(a)}},{}],6:[function(a,b){b.exports=function(a,b,c,d){d=d||c,c="exact"===c?!0:!1;var e=c?a===b:a==b;return e?d.fn():d.inverse()}},{}],7:[function(a,b){b.exports=function(a,b,c){c=c||b,b="number"==typeof b?b:1;var d="",e=0;for(var f in a)if(a.hasOwnProperty(f)&&(d+=c.fn(a[f]),e++,e==b))return d}},{}],8:[function(a,b){var c=a("strftime").strftimeTZ,d=a("new-date");b.exports=function(a,b,e){e="number"==typeof e?e:null;var f=d(a);return c(b,f,e)}},{"new-date":23,strftime:28}],9:[function(a,b){b.exports=function(a,b,c,d){d=d||c,c="equal"===c?!0:!1;var e=c?a>=b:a>b;return e?d.fn():d.inverse()}},{}],10:[function(a,b){b.exports=function(a,b){if(b="string"==typeof b?b:"",a.join)return a.join(b);var c="";for(var d in a)a.hasOwnProperty(d)&&(c+=a[d]+b);return c.slice(0,-b.length)}},{}],11:[function(a,b){b.exports=function(a,b,c){c=c||b,b="number"==typeof b?b:1;for(var d="",e=0;e<a.length;e++)if(d+=c.fn(a[a.length-b+e]),e+1==b)return d}},{}],12:[function(a,b){b.exports=function(a){if(a.length)return a.length;var b=0;for(var c in a)a.hasOwnProperty(c)&&b++;return b}},{}],13:[function(a,b){b.exports=function(a,b,c,d){d=d||c,c="equal"===c?!0:!1;var e=c?b>=a:b>a;return e?d.fn():d.inverse()}},{}],14:[function(a,b){b.exports=function(a){return(a||"").toLowerCase()}},{}],15:[function(a,b){b.exports=function(a,b,c,d){if(d=d||c,"number"==typeof b){var e="number"!=typeof c?void 0:b+c;a=a.slice(b,e);for(var f="",g=0;g<a.length;g++)f+=d.fn(a[g]);return f}}},{}],16:[function(a,b){b.exports=function(a,b,c){return(a||"").replace(b,c)}},{}],17:[function(a,b){b.exports=function(a,b){for(var c="",d=a.length-1;d>=0;d--)c+=b.fn(a[d]);return c}},{}],18:[function(a,b){var c=function(a){for(var b,c,d=a.length;d;)b=Math.floor(Math.random()*d--),c=a[d],a[d]=a[b],a[b]=c;return a};b.exports=function(a,b){for(var d=c(a),e="",f=0;f<d.length;f++)e+=b.fn(d[f]);return e}},{}],19:[function(a,b){b.exports=function(a,b,c){c=c||b,b="zero"===b?!0:!1;var d,e="";if(b)for(d=0;a>d;d++)e+=c.fn(d);else for(d=1;a>=d;d++)e+=c.fn(d);return e}},{}],20:[function(a,b){b.exports=function(a){return(a||"").toUpperCase()}},{}],21:[function(a,b){b.exports=function(a,b,c,d,e){e=e||d,"number"!=typeof d&&(d=1/0);for(var f=0,g="",h=0;h<a.length;h++)if(a[h][b]===c&&(g+=e.fn(a[h]),f++,f===d))return g;return g}},{}],22:[function(a,b){var c={lowercase:a("./helpers/lowercase.js"),uppercase:a("./helpers/uppercase.js"),replace:a("./helpers/replace.js"),encode:a("./helpers/encode.js"),length:a("./helpers/length.js"),contains:a("./helpers/contains.js"),first:a("./helpers/first.js"),last:a("./helpers/last.js"),between:a("./helpers/between.js"),range:a("./helpers/range.js"),where:a("./helpers/where.js"),shuffle:a("./helpers/shuffle.js"),reverse:a("./helpers/reverse.js"),join:a("./helpers/join.js"),ago:a("./helpers/ago.js"),formatDate:a("./helpers/formatDate.js"),equal:a("./helpers/equal.js"),greater:a("./helpers/greater.js"),less:a("./helpers/less.js"),times:a("./helpers/times.js")};b.exports.help=function(a){for(var b in c)a.registerHelper(b,c[b])}},{"./helpers/ago.js":2,"./helpers/between.js":3,"./helpers/contains.js":4,"./helpers/encode.js":5,"./helpers/equal.js":6,"./helpers/first.js":7,"./helpers/formatDate.js":8,"./helpers/greater.js":9,"./helpers/join.js":10,"./helpers/last.js":11,"./helpers/length.js":12,"./helpers/less.js":13,"./helpers/lowercase.js":14,"./helpers/range.js":15,"./helpers/replace.js":16,"./helpers/reverse.js":17,"./helpers/shuffle.js":18,"./helpers/times.js":19,"./helpers/uppercase.js":20,"./helpers/where.js":21}],23:[function(a,b){function c(a){return 315576e5>a?1e3*a:a}var d=a("is"),e=a("isodate"),f=a("./milliseconds"),g=a("./seconds");b.exports=function(a){return d.number(a)?new Date(c(a)):d.date(a)?new Date(a.getTime()):e.is(a)?e.parse(a):f.is(a)?f.parse(a):g.is(a)?g.parse(a):new Date(a)}},{"./milliseconds":24,"./seconds":25,is:26,isodate:27}],24:[function(a,b,c){var d=/\d{13}/;c.is=function(a){return d.test(a)},c.parse=function(a){return a=parseInt(a,10),new Date(a)}},{}],25:[function(a,b,c){var d=/\d{10}/;c.is=function(a){return d.test(a)},c.parse=function(a){var b=1e3*parseInt(a,10);return new Date(b)}},{}],26:[function(a,b){var c=Object.prototype,d=c.hasOwnProperty,e=c.toString,f=function(a){return a!==a},g={"boolean":1,number:1,string:1,undefined:1},h=b.exports={};h.a=h.type=function(a,b){return typeof a===b},h.defined=function(a){return void 0!==a},h.empty=function(a){var b,c=e.call(a);if("[object Array]"===c||"[object Arguments]"===c)return 0===a.length;if("[object Object]"===c){for(b in a)if(d.call(a,b))return!1;return!0}return"[object String]"===c?""===a:!1},h.equal=function(a,b){var c,d=e.call(a);if(d!==e.call(b))return!1;if("[object Object]"===d){for(c in a)if(!h.equal(a[c],b[c]))return!1;return!0}if("[object Array]"===d){if(c=a.length,c!==b.length)return!1;for(;--c;)if(!h.equal(a[c],b[c]))return!1;return!0}return"[object Function]"===d?a.prototype===b.prototype:"[object Date]"===d?a.getTime()===b.getTime():a===b},h.hosted=function(a,b){var c=typeof b[a];return"object"===c?!!b[a]:!g[c]},h.instance=h["instanceof"]=function(a,b){return a instanceof b},h["null"]=function(a){return null===a},h.undefined=function(a){return void 0===a},h.arguments=function(a){var b="[object Arguments]"===e.call(a),c=!h.array(a)&&h.arraylike(a)&&h.object(a)&&h.fn(a.callee);return b||c},h.array=function(a){return"[object Array]"===e.call(a)},h.arguments.empty=function(a){return h.arguments(a)&&0===a.length},h.array.empty=function(a){return h.array(a)&&0===a.length},h.arraylike=function(a){return!!a&&!h.boolean(a)&&d.call(a,"length")&&isFinite(a.length)&&h.number(a.length)&&a.length>=0},h.boolean=function(a){return"[object Boolean]"===e.call(a)},h["false"]=function(a){return h.boolean(a)&&(a===!1||a.valueOf()===!1)},h["true"]=function(a){return h.boolean(a)&&(a===!0||a.valueOf()===!0)},h.date=function(a){return"[object Date]"===e.call(a)},h.element=function(a){return void 0!==a&&"undefined"!=typeof HTMLElement&&a instanceof HTMLElement&&1===a.nodeType},h.error=function(a){return"[object Error]"===e.call(a)},h.fn=h["function"]=function(a){var b="undefined"!=typeof window&&a===window.alert;return b||"[object Function]"===e.call(a)},h.number=function(a){return"[object Number]"===e.call(a)},h.infinite=function(a){return 1/0===a||a===-1/0},h.decimal=function(a){return h.number(a)&&!f(a)&&0!==a%1},h.divisibleBy=function(a,b){var c=h.infinite(a),d=h.infinite(b),e=h.number(a)&&!f(a)&&h.number(b)&&!f(b)&&0!==b;return c||d||e&&0===a%b},h.int=function(a){return h.number(a)&&!f(a)&&0===a%1},h.maximum=function(a,b){if(f(a))throw new TypeError("NaN is not a valid value");if(!h.arraylike(b))throw new TypeError("second argument must be array-like");for(var c=b.length;--c>=0;)if(a<b[c])return!1;return!0},h.minimum=function(a,b){if(f(a))throw new TypeError("NaN is not a valid value");if(!h.arraylike(b))throw new TypeError("second argument must be array-like");for(var c=b.length;--c>=0;)if(a>b[c])return!1;return!0},h.nan=function(a){return!h.number(a)||a!==a},h.even=function(a){return h.infinite(a)||h.number(a)&&a===a&&0===a%2},h.odd=function(a){return h.infinite(a)||h.number(a)&&a===a&&0!==a%2},h.ge=function(a,b){if(f(a)||f(b))throw new TypeError("NaN is not a valid value");return!h.infinite(a)&&!h.infinite(b)&&a>=b},h.gt=function(a,b){if(f(a)||f(b))throw new TypeError("NaN is not a valid value");return!h.infinite(a)&&!h.infinite(b)&&a>b},h.le=function(a,b){if(f(a)||f(b))throw new TypeError("NaN is not a valid value");return!h.infinite(a)&&!h.infinite(b)&&b>=a},h.lt=function(a,b){if(f(a)||f(b))throw new TypeError("NaN is not a valid value");return!h.infinite(a)&&!h.infinite(b)&&b>a},h.within=function(a,b,c){if(f(a)||f(b)||f(c))throw new TypeError("NaN is not a valid value");if(!h.number(a)||!h.number(b)||!h.number(c))throw new TypeError("all arguments must be numbers");var d=h.infinite(a)||h.infinite(b)||h.infinite(c);return d||a>=b&&c>=a},h.object=function(a){return a&&"[object Object]"===e.call(a)},h.hash=function(a){return h.object(a)&&a.constructor===Object&&!a.nodeType&&!a.setInterval},h.regexp=function(a){return"[object RegExp]"===e.call(a)},h.string=function(a){return"[object String]"===e.call(a)}},{}],27:[function(a,b,c){var d=/^(\d{4})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:([ T])(\d{2}):?(\d{2})(?::?(\d{2})(?:[,\.](\d{1,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?)?)?$/;c.parse=function(a){var b=[1,5,6,7,8,11,12],c=d.exec(a),e=0;if(!c)return new Date(a);for(var f,g=0;f=b[g];g++)c[f]=parseInt(c[f],10)||0;c[2]=parseInt(c[2],10)||1,c[3]=parseInt(c[3],10)||1,c[2]--,c[8]&&(c[8]=(c[8]+"00").substring(0,3))," "==c[4]?e=(new Date).getTimezoneOffset():"Z"!==c[9]&&c[10]&&(e=60*c[11]+c[12],"+"==c[10]&&(e=0-e));var h=Date.UTC(c[1],c[2],c[3],c[5],c[6]+e,c[7],c[8]);return new Date(h)},c.is=function(a,b){return b&&!1===/^\d{4}-\d{2}-\d{2}/.test(a)?!1:d.test(a)}},{}],28:[function(a,b){!function(){function a(a){return(a||"").split(" ")}function c(a,b,c){return g(a,b,c)}function d(a,b,c,d){return"number"==typeof c&&null==d&&(d=c,c=void 0),g(a,b,c,{timezone:d})}function e(a,b,c){return g(a,b,c,{utc:!0})}function f(a){return function(b,d,e){return c(b,d,a,e)}}function g(a,b,c,d){d=d||{},b&&!i(b)&&(c=b,b=void 0),b=b||new Date,c=c||o,c.formats=c.formats||{};var e=b.getTime();return(d.utc||"number"==typeof d.timezone)&&(b=h(b)),"number"==typeof d.timezone&&(b=new Date(b.getTime()+6e4*d.timezone)),a.replace(/%([-_0]?.)/g,function(a,f){var h,i;if(2==f.length){if(h=f[0],"-"==h)i="";else if("_"==h)i=" ";else{if("0"!=h)return a;i="0"}f=f[1]}switch(f){case"A":return c.days[b.getDay()];case"a":return c.shortDays[b.getDay()];case"B":return c.months[b.getMonth()];case"b":return c.shortMonths[b.getMonth()];case"C":return j(Math.floor(b.getFullYear()/100),i);case"D":return g(c.formats.D||"%m/%d/%y",b,c);case"d":return j(b.getDate(),i);case"e":return b.getDate();case"F":return g(c.formats.F||"%Y-%m-%d",b,c);case"H":return j(b.getHours(),i);case"h":return c.shortMonths[b.getMonth()];case"I":return j(k(b),i);case"j":var n=new Date(b.getFullYear(),0,1),o=Math.ceil((b.getTime()-n.getTime())/864e5);return j(o,3);case"k":return j(b.getHours(),null==i?" ":i);case"L":return j(Math.floor(e%1e3),3);case"l":return j(k(b),null==i?" ":i);case"M":return j(b.getMinutes(),i);case"m":return j(b.getMonth()+1,i);case"n":return"\n";case"o":return String(b.getDate())+l(b.getDate());case"P":return b.getHours()<12?c.am:c.pm;case"p":return b.getHours()<12?c.AM:c.PM;case"R":return g(c.formats.R||"%H:%M",b,c);case"r":return g(c.formats.r||"%I:%M:%S %p",b,c);case"S":return j(b.getSeconds(),i);case"s":return Math.floor(e/1e3);case"T":return g(c.formats.T||"%H:%M:%S",b,c);case"t":return" ";case"U":return j(m(b,"sunday"),i);case"u":var o=b.getDay();return 0==o?7:o;case"v":return g(c.formats.v||"%e-%b-%Y",b,c);case"W":return j(m(b,"monday"),i);case"w":return b.getDay();case"Y":return b.getFullYear();case"y":var n=String(b.getFullYear());return n.slice(n.length-2);case"Z":if(d.utc)return"GMT";var p=b.toString().match(/\((\w+)\)/);return p&&p[1]||"";case"z":if(d.utc)return"+0000";var q="number"==typeof d.timezone?d.timezone:-b.getTimezoneOffset();return(0>q?"-":"+")+j(Math.abs(q/60))+j(q%60);default:return f}})}function h(a){var b=6e4*(a.getTimezoneOffset()||0);return new Date(a.getTime()+b)}function i(a){var b=0,c=p.length;for(b=0;c>b;++b)if("function"!=typeof a[p[b]])return!1;return!0}function j(a,b,c){"number"==typeof b&&(c=b,b="0"),null==b&&(b="0"),c=c||2;var d=String(a);if(b)for(;d.length<c;)d=b+d;return d}function k(a){var b=a.getHours();return 0==b?b=12:b>12&&(b-=12),b}function l(a){var b=a%10,c=a%100;if(c>=11&&13>=c||0===b||b>=4)return"th";switch(b){case 1:return"st";case 2:return"nd";case 3:return"rd"}}function m(a,b){b=b||"sunday";var c=a.getDay();"monday"==b&&(0==c?c=6:c--);var d=new Date(a.getFullYear(),0,1),e=(a-d)/864e5,f=(e+7-c)/7;return Math.floor(f)}var n;n="undefined"!=typeof b?b.exports=c:function(){return this||(1,eval)("this")}();var o={days:a("Sunday Monday Tuesday Wednesday Thursday Friday Saturday"),shortDays:a("Sun Mon Tue Wed Thu Fri Sat"),months:a("January February March April May June July August September October November December"),shortMonths:a("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec"),AM:"AM",PM:"PM",am:"am",pm:"pm"};n.strftime=c,n.strftimeTZ=c.strftimeTZ=d,n.strftimeUTC=c.strftimeUTC=e,n.localizedStrftime=c.localizedStrftime=f;var p=["getTime","getTimezoneOffset","getDay","getDate","getMonth","getFullYear","getYear","getHours","getMinutes","getSeconds"]}()},{}]},{},[1])(1)});
!function(a){if("function"==typeof bootstrap)bootstrap("handlebars_helper",a);else if("object"==typeof exports)module.exports=a();else if("function"==typeof define&&define.amd)define(a);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeHandlebarshelper=a}else"undefined"!=typeof window?window.handlebarshelper=a():global.handlebarshelper=a()}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b){b.exports=a("./lib")},{"./lib":22}],2:[function(a,b){var c=a("new-date"),d=31536e3,e=2592e3,f=86400,g=3600;b.exports=function(a){a=c(a);var b=Math.floor((new Date-a)/1e3),h=Math.floor(b/d);return h>1?h+" years ago":(h=Math.floor(b/e),h>1?h+" months ago":(h=Math.floor(b/f),h>1?h+" days ago":(h=Math.floor(b/g),h>1?h+" hours ago":(h=Math.floor(b/60),h>1?h+" minutes ago":Math.floor(b)<=1?"Just now":Math.floor(b)+" seconds ago"))))}},{"new-date":23}],3:[function(a,b){b.exports=function(a,b,c,d){if(d=d||c,"number"==typeof b){c="number"!=typeof c?void 0:c>0?c+1:c,a=a.slice(b,c);for(var e="",f=0;f<a.length;f++)e+=d.fn(a[f]);return e}}},{}],4:[function(a,b){b.exports=function(a,b,c){if("string"==typeof a)return a.search(b)>=0?c.fn(this):c.inverse(this);for(var d in a)if(a.hasOwnProperty(d)&&a[d]==b)return c.fn(this);return c.inverse(this)}},{}],5:[function(a,b){b.exports=function(a){return encodeURIComponent(a)}},{}],6:[function(a,b){b.exports=function(a,b,c,d){d=d||c,c="exact"===c?!0:!1;var e=c?a===b:a==b;return e?d.fn(this):d.inverse(this)}},{}],7:[function(a,b){b.exports=function(a,b,c){c=c||b,b="number"==typeof b?b:1;var d="",e=0;for(var f in a)if(a.hasOwnProperty(f)&&(d+=c.fn(a[f]),e++,e==b))return d}},{}],8:[function(a,b){var c=a("strftime").strftimeTZ,d=a("new-date");b.exports=function(a,b,e){e="number"==typeof e?e:null;var f=d(a);return c(b,f,e)}},{"new-date":23,strftime:28}],9:[function(a,b){b.exports=function(a,b,c,d){d=d||c,c="equal"===c?!0:!1;var e=c?a>=b:a>b;return e?d.fn(this):d.inverse(this)}},{}],10:[function(a,b){b.exports=function(a,b){if(b="string"==typeof b?b:"",a.join)return a.join(b);var c="";for(var d in a)a.hasOwnProperty(d)&&(c+=a[d]+b);return c.slice(0,-b.length)}},{}],11:[function(a,b){b.exports=function(a,b,c){c=c||b,b="number"==typeof b?b:1;for(var d="",e=0;e<a.length;e++)if(d+=c.fn(a[a.length-b+e]),e+1==b)return d}},{}],12:[function(a,b){b.exports=function(a){if(a.length)return a.length;var b=0;for(var c in a)a.hasOwnProperty(c)&&b++;return b}},{}],13:[function(a,b){b.exports=function(a,b,c,d){d=d||c,c="equal"===c?!0:!1;var e=c?b>=a:b>a;return e?d.fn(this):d.inverse(this)}},{}],14:[function(a,b){b.exports=function(a){return(a||"").toLowerCase()}},{}],15:[function(a,b){b.exports=function(a,b,c,d){if(d=d||c,"number"==typeof b){var e="number"!=typeof c?void 0:b+c;a=a.slice(b,e);for(var f="",g=0;g<a.length;g++)f+=d.fn(a[g]);return f}}},{}],16:[function(a,b){b.exports=function(a,b,c){return(a||"").replace(b,c)}},{}],17:[function(a,b){b.exports=function(a,b){for(var c="",d=a.length-1;d>=0;d--)c+=b.fn(a[d]);return c}},{}],18:[function(a,b){var c=function(a){for(var b,c,d=a.length;d;)b=Math.floor(Math.random()*d--),c=a[d],a[d]=a[b],a[b]=c;return a};b.exports=function(a,b){for(var d=c(a),e="",f=0;f<d.length;f++)e+=b.fn(d[f]);return e}},{}],19:[function(a,b){b.exports=function(a,b,c){c=c||b,b="zero"===b?!0:!1;var d,e="";if(b)for(d=0;a>d;d++)e+=c.fn(d);else for(d=1;a>=d;d++)e+=c.fn(d);return e}},{}],20:[function(a,b){b.exports=function(a){return(a||"").toUpperCase()}},{}],21:[function(a,b){b.exports=function(a,b,c,d,e){e=e||d,"number"!=typeof d&&(d=1/0);for(var f=0,g="",h=0;h<a.length;h++)if(a[h][b]===c&&(g+=e.fn(a[h]),f++,f===d))return g;return g}},{}],22:[function(a,b){var c={lowercase:a("./helpers/lowercase.js"),uppercase:a("./helpers/uppercase.js"),replace:a("./helpers/replace.js"),encode:a("./helpers/encode.js"),length:a("./helpers/length.js"),contains:a("./helpers/contains.js"),first:a("./helpers/first.js"),last:a("./helpers/last.js"),between:a("./helpers/between.js"),range:a("./helpers/range.js"),where:a("./helpers/where.js"),shuffle:a("./helpers/shuffle.js"),reverse:a("./helpers/reverse.js"),join:a("./helpers/join.js"),ago:a("./helpers/ago.js"),formatDate:a("./helpers/formatDate.js"),equal:a("./helpers/equal.js"),greater:a("./helpers/greater.js"),less:a("./helpers/less.js"),times:a("./helpers/times.js")};b.exports.help=function(a){for(var b in c)a.registerHelper(b,c[b])}},{"./helpers/ago.js":2,"./helpers/between.js":3,"./helpers/contains.js":4,"./helpers/encode.js":5,"./helpers/equal.js":6,"./helpers/first.js":7,"./helpers/formatDate.js":8,"./helpers/greater.js":9,"./helpers/join.js":10,"./helpers/last.js":11,"./helpers/length.js":12,"./helpers/less.js":13,"./helpers/lowercase.js":14,"./helpers/range.js":15,"./helpers/replace.js":16,"./helpers/reverse.js":17,"./helpers/shuffle.js":18,"./helpers/times.js":19,"./helpers/uppercase.js":20,"./helpers/where.js":21}],23:[function(a,b){function c(a){return 315576e5>a?1e3*a:a}var d=a("is"),e=a("isodate"),f=a("./milliseconds"),g=a("./seconds");b.exports=function(a){return d.number(a)?new Date(c(a)):d.date(a)?new Date(a.getTime()):e.is(a)?e.parse(a):f.is(a)?f.parse(a):g.is(a)?g.parse(a):new Date(a)}},{"./milliseconds":24,"./seconds":25,is:26,isodate:27}],24:[function(a,b,c){var d=/\d{13}/;c.is=function(a){return d.test(a)},c.parse=function(a){return a=parseInt(a,10),new Date(a)}},{}],25:[function(a,b,c){var d=/\d{10}/;c.is=function(a){return d.test(a)},c.parse=function(a){var b=1e3*parseInt(a,10);return new Date(b)}},{}],26:[function(a,b){var c=Object.prototype,d=c.hasOwnProperty,e=c.toString,f=function(a){return a!==a},g={"boolean":1,number:1,string:1,undefined:1},h=b.exports={};h.a=h.type=function(a,b){return typeof a===b},h.defined=function(a){return void 0!==a},h.empty=function(a){var b,c=e.call(a);if("[object Array]"===c||"[object Arguments]"===c)return 0===a.length;if("[object Object]"===c){for(b in a)if(d.call(a,b))return!1;return!0}return"[object String]"===c?""===a:!1},h.equal=function(a,b){var c,d=e.call(a);if(d!==e.call(b))return!1;if("[object Object]"===d){for(c in a)if(!h.equal(a[c],b[c]))return!1;return!0}if("[object Array]"===d){if(c=a.length,c!==b.length)return!1;for(;--c;)if(!h.equal(a[c],b[c]))return!1;return!0}return"[object Function]"===d?a.prototype===b.prototype:"[object Date]"===d?a.getTime()===b.getTime():a===b},h.hosted=function(a,b){var c=typeof b[a];return"object"===c?!!b[a]:!g[c]},h.instance=h["instanceof"]=function(a,b){return a instanceof b},h["null"]=function(a){return null===a},h.undefined=function(a){return void 0===a},h.arguments=function(a){var b="[object Arguments]"===e.call(a),c=!h.array(a)&&h.arraylike(a)&&h.object(a)&&h.fn(a.callee);return b||c},h.array=function(a){return"[object Array]"===e.call(a)},h.arguments.empty=function(a){return h.arguments(a)&&0===a.length},h.array.empty=function(a){return h.array(a)&&0===a.length},h.arraylike=function(a){return!!a&&!h.boolean(a)&&d.call(a,"length")&&isFinite(a.length)&&h.number(a.length)&&a.length>=0},h.boolean=function(a){return"[object Boolean]"===e.call(a)},h["false"]=function(a){return h.boolean(a)&&(a===!1||a.valueOf()===!1)},h["true"]=function(a){return h.boolean(a)&&(a===!0||a.valueOf()===!0)},h.date=function(a){return"[object Date]"===e.call(a)},h.element=function(a){return void 0!==a&&"undefined"!=typeof HTMLElement&&a instanceof HTMLElement&&1===a.nodeType},h.error=function(a){return"[object Error]"===e.call(a)},h.fn=h["function"]=function(a){var b="undefined"!=typeof window&&a===window.alert;return b||"[object Function]"===e.call(a)},h.number=function(a){return"[object Number]"===e.call(a)},h.infinite=function(a){return 1/0===a||a===-1/0},h.decimal=function(a){return h.number(a)&&!f(a)&&0!==a%1},h.divisibleBy=function(a,b){var c=h.infinite(a),d=h.infinite(b),e=h.number(a)&&!f(a)&&h.number(b)&&!f(b)&&0!==b;return c||d||e&&0===a%b},h.int=function(a){return h.number(a)&&!f(a)&&0===a%1},h.maximum=function(a,b){if(f(a))throw new TypeError("NaN is not a valid value");if(!h.arraylike(b))throw new TypeError("second argument must be array-like");for(var c=b.length;--c>=0;)if(a<b[c])return!1;return!0},h.minimum=function(a,b){if(f(a))throw new TypeError("NaN is not a valid value");if(!h.arraylike(b))throw new TypeError("second argument must be array-like");for(var c=b.length;--c>=0;)if(a>b[c])return!1;return!0},h.nan=function(a){return!h.number(a)||a!==a},h.even=function(a){return h.infinite(a)||h.number(a)&&a===a&&0===a%2},h.odd=function(a){return h.infinite(a)||h.number(a)&&a===a&&0!==a%2},h.ge=function(a,b){if(f(a)||f(b))throw new TypeError("NaN is not a valid value");return!h.infinite(a)&&!h.infinite(b)&&a>=b},h.gt=function(a,b){if(f(a)||f(b))throw new TypeError("NaN is not a valid value");return!h.infinite(a)&&!h.infinite(b)&&a>b},h.le=function(a,b){if(f(a)||f(b))throw new TypeError("NaN is not a valid value");return!h.infinite(a)&&!h.infinite(b)&&b>=a},h.lt=function(a,b){if(f(a)||f(b))throw new TypeError("NaN is not a valid value");return!h.infinite(a)&&!h.infinite(b)&&b>a},h.within=function(a,b,c){if(f(a)||f(b)||f(c))throw new TypeError("NaN is not a valid value");if(!h.number(a)||!h.number(b)||!h.number(c))throw new TypeError("all arguments must be numbers");var d=h.infinite(a)||h.infinite(b)||h.infinite(c);return d||a>=b&&c>=a},h.object=function(a){return a&&"[object Object]"===e.call(a)},h.hash=function(a){return h.object(a)&&a.constructor===Object&&!a.nodeType&&!a.setInterval},h.regexp=function(a){return"[object RegExp]"===e.call(a)},h.string=function(a){return"[object String]"===e.call(a)}},{}],27:[function(a,b,c){var d=/^(\d{4})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:([ T])(\d{2}):?(\d{2})(?::?(\d{2})(?:[,\.](\d{1,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?)?)?$/;c.parse=function(a){var b=[1,5,6,7,8,11,12],c=d.exec(a),e=0;if(!c)return new Date(a);for(var f,g=0;f=b[g];g++)c[f]=parseInt(c[f],10)||0;c[2]=parseInt(c[2],10)||1,c[3]=parseInt(c[3],10)||1,c[2]--,c[8]&&(c[8]=(c[8]+"00").substring(0,3))," "==c[4]?e=(new Date).getTimezoneOffset():"Z"!==c[9]&&c[10]&&(e=60*c[11]+c[12],"+"==c[10]&&(e=0-e));var h=Date.UTC(c[1],c[2],c[3],c[5],c[6]+e,c[7],c[8]);return new Date(h)},c.is=function(a,b){return b&&!1===/^\d{4}-\d{2}-\d{2}/.test(a)?!1:d.test(a)}},{}],28:[function(a,b){!function(){function a(a){return(a||"").split(" ")}function c(a,b,c){return g(a,b,c)}function d(a,b,c,d){return"number"==typeof c&&null==d&&(d=c,c=void 0),g(a,b,c,{timezone:d})}function e(a,b,c){return g(a,b,c,{utc:!0})}function f(a){return function(b,d,e){return c(b,d,a,e)}}function g(a,b,c,d){d=d||{},b&&!i(b)&&(c=b,b=void 0),b=b||new Date,c=c||o,c.formats=c.formats||{};var e=b.getTime();return(d.utc||"number"==typeof d.timezone)&&(b=h(b)),"number"==typeof d.timezone&&(b=new Date(b.getTime()+6e4*d.timezone)),a.replace(/%([-_0]?.)/g,function(a,f){var h,i;if(2==f.length){if(h=f[0],"-"==h)i="";else if("_"==h)i=" ";else{if("0"!=h)return a;i="0"}f=f[1]}switch(f){case"A":return c.days[b.getDay()];case"a":return c.shortDays[b.getDay()];case"B":return c.months[b.getMonth()];case"b":return c.shortMonths[b.getMonth()];case"C":return j(Math.floor(b.getFullYear()/100),i);case"D":return g(c.formats.D||"%m/%d/%y",b,c);case"d":return j(b.getDate(),i);case"e":return b.getDate();case"F":return g(c.formats.F||"%Y-%m-%d",b,c);case"H":return j(b.getHours(),i);case"h":return c.shortMonths[b.getMonth()];case"I":return j(k(b),i);case"j":var n=new Date(b.getFullYear(),0,1),o=Math.ceil((b.getTime()-n.getTime())/864e5);return j(o,3);case"k":return j(b.getHours(),null==i?" ":i);case"L":return j(Math.floor(e%1e3),3);case"l":return j(k(b),null==i?" ":i);case"M":return j(b.getMinutes(),i);case"m":return j(b.getMonth()+1,i);case"n":return"\n";case"o":return String(b.getDate())+l(b.getDate());case"P":return b.getHours()<12?c.am:c.pm;case"p":return b.getHours()<12?c.AM:c.PM;case"R":return g(c.formats.R||"%H:%M",b,c);case"r":return g(c.formats.r||"%I:%M:%S %p",b,c);case"S":return j(b.getSeconds(),i);case"s":return Math.floor(e/1e3);case"T":return g(c.formats.T||"%H:%M:%S",b,c);case"t":return" ";case"U":return j(m(b,"sunday"),i);case"u":var o=b.getDay();return 0==o?7:o;case"v":return g(c.formats.v||"%e-%b-%Y",b,c);case"W":return j(m(b,"monday"),i);case"w":return b.getDay();case"Y":return b.getFullYear();case"y":var n=String(b.getFullYear());return n.slice(n.length-2);case"Z":if(d.utc)return"GMT";var p=b.toString().match(/\((\w+)\)/);return p&&p[1]||"";case"z":if(d.utc)return"+0000";var q="number"==typeof d.timezone?d.timezone:-b.getTimezoneOffset();return(0>q?"-":"+")+j(Math.abs(q/60))+j(q%60);default:return f}})}function h(a){var b=6e4*(a.getTimezoneOffset()||0);return new Date(a.getTime()+b)}function i(a){var b=0,c=p.length;for(b=0;c>b;++b)if("function"!=typeof a[p[b]])return!1;return!0}function j(a,b,c){"number"==typeof b&&(c=b,b="0"),null==b&&(b="0"),c=c||2;var d=String(a);if(b)for(;d.length<c;)d=b+d;return d}function k(a){var b=a.getHours();return 0==b?b=12:b>12&&(b-=12),b}function l(a){var b=a%10,c=a%100;if(c>=11&&13>=c||0===b||b>=4)return"th";switch(b){case 1:return"st";case 2:return"nd";case 3:return"rd"}}function m(a,b){b=b||"sunday";var c=a.getDay();"monday"==b&&(0==c?c=6:c--);var d=new Date(a.getFullYear(),0,1),e=(a-d)/864e5,f=(e+7-c)/7;return Math.floor(f)}var n;n="undefined"!=typeof b?b.exports=c:function(){return this||(1,eval)("this")}();var o={days:a("Sunday Monday Tuesday Wednesday Thursday Friday Saturday"),shortDays:a("Sun Mon Tue Wed Thu Fri Sat"),months:a("January February March April May June July August September October November December"),shortMonths:a("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec"),AM:"AM",PM:"PM",am:"am",pm:"pm"};n.strftime=c,n.strftimeTZ=c.strftimeTZ=d,n.strftimeUTC=c.strftimeUTC=e,n.localizedStrftime=c.localizedStrftime=f;var p=["getTime","getTimezoneOffset","getDay","getDate","getMonth","getFullYear","getYear","getHours","getMinutes","getSeconds"]}()},{}]},{},[1])(1)});

@@ -5,6 +5,6 @@ module.exports = function( collection, item, options ){

if( collection.search( item ) >= 0 ){
return options.fn();
return options.fn(this);
}
else {
return options.inverse();
return options.inverse(this);
}

@@ -15,6 +15,6 @@ }

if( collection.hasOwnProperty( prop ) ){
if( collection[prop] == item ) return options.fn();
if( collection[prop] == item ) return options.fn(this);
}
}
return options.inverse();
return options.inverse(this);
};

@@ -5,4 +5,4 @@ module.exports = function( left, right, exact, options ){

var is_equal = exact ? ( left === right ) : ( left == right );
if( is_equal ) return options.fn();
return options.inverse();
if( is_equal ) return options.fn(this);
return options.inverse(this);
};

@@ -5,4 +5,4 @@ module.exports = function( left, right, equal, options ){

var is_greater = equal ? ( left >= right ) : ( left > right );
if( is_greater ) return options.fn();
return options.inverse();
if( is_greater ) return options.fn( this );
return options.inverse( this );
};

@@ -5,4 +5,4 @@ module.exports = function( left, right, equal, options ){

var is_greater = equal ? ( left <= right ) : ( left < right );
if( is_greater ) return options.fn();
return options.inverse();
if( is_greater ) return options.fn( this );
return options.inverse( this );
};
{
"name": "handlebars-helper",
"version": "0.0.7",
"version": "0.0.8",
"description": "A collection of helpers for quick and tasty Handlebars templates",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -64,3 +64,3 @@ var assert = require('assert');

test( 'contains', function( t ){
t.plan(6);
t.plan(7);
var data = {

@@ -80,3 +80,4 @@ array: ['Solid', 'Liquid', 'Solidus'],

string: 'Solidus Snake',
string2: 'Solid Snake'
string2: 'Solid Snake',
context: 'confirmed'
};

@@ -90,2 +91,4 @@ var tpl = Handlebars.compile('{{#contains this "Solidus"}}Yup{{else}}Nope{{/contains}}.');

t.ok( tpl( data.string2 ) === 'Nope.', 'renders else block when substring is not in string' );
var tpl_context = Handlebars.compile('{{#contains this.array "Solidus"}}{{context}}{{/contains}}');
t.ok( tpl_context( data ) === 'confirmed', 'executes block in parent context' );
});

@@ -237,70 +240,85 @@

test( 'equal', function( t ){
t.plan(6);
var data = [{
left: 1,
right: 1
}, {
left: 1,
right: '1'
}, {
left: 1,
right: 2
}];
t.plan(7);
var data = {
pairs: [{
left: 1,
right: 1
}, {
left: 1,
right: '1'
}, {
left: 1,
right: 2
}],
context: 'confirmed'
};
var tpl = Handlebars.compile('{{#equal left right}}Yup.{{else}}Nope.{{/equal}}');
t.ok( tpl( data[0] ) === 'Yup.', 'Renders positive block when items are equal' );
t.ok( tpl( data[1] ) === 'Yup.', 'Renders positive block when items are equal, of different types' );
t.ok( tpl( data[2] ) === 'Nope.', 'Renders inverse block when items are inequal' );
t.ok( tpl( data.pairs[0] ) === 'Yup.', 'Renders positive block when items are equal' );
t.ok( tpl( data.pairs[1] ) === 'Yup.', 'Renders positive block when items are equal, of different types' );
t.ok( tpl( data.pairs[2] ) === 'Nope.', 'Renders inverse block when items are inequal' );
var tpl2 = Handlebars.compile('{{#equal left right "exact"}}Yup.{{else}}Nope.{{/equal}}');
t.ok( tpl2( data[0] ) === 'Yup.', 'Renders positive block when items are equal, exact check' );
t.ok( tpl2( data[1] ) === 'Nope.', 'Renders inverse block when items are equal, of different types, exact check' );
t.ok( tpl2( data.pairs[0] ) === 'Yup.', 'Renders positive block when items are equal, exact check' );
t.ok( tpl2( data.pairs[1] ) === 'Nope.', 'Renders inverse block when items are equal, of different types, exact check' );
var tpl3 = Handlebars.compile('{{^equal left right}}Yup.{{else}}Nope.{{/equal}}');
t.ok( tpl3( data[2] ) === 'Yup.', 'Renders inverse block when items are inequal, inverse is used' );
t.ok( tpl3( data.pairs[2] ) === 'Yup.', 'Renders inverse block when items are inequal, inverse is used' );
var tpl_context = Handlebars.compile('{{#equal 1 1}}{{context}}{{/equal}}');
t.ok( tpl_context( data ) === 'confirmed', 'executes block in parent context' );
});
test( 'greater', function( t ){
t.plan(7);
var data = [{
left: 2,
right: 1
}, {
left: 1,
right: 2
}, {
left: 2,
right: 2
}];
t.plan(8);
var data = {
pairs: [{
left: 2,
right: 1
}, {
left: 1,
right: 2
}, {
left: 2,
right: 2
}],
context: 'confirmed'
};
var tpl = Handlebars.compile('{{#greater left right}}Yup.{{else}}Nope.{{/greater}}');
t.ok( tpl( data[0] ) === 'Yup.', 'Renders positive block when left is greater' );
t.ok( tpl( data[1] ) === 'Nope.', 'Renders inverse block when left is less' );
t.ok( tpl( data[2] ) === 'Nope.', 'Renders inverse block when left and right are equal' );
t.ok( tpl( data.pairs[0] ) === 'Yup.', 'Renders positive block when left is greater' );
t.ok( tpl( data.pairs[1] ) === 'Nope.', 'Renders inverse block when left is less' );
t.ok( tpl( data.pairs[2] ) === 'Nope.', 'Renders inverse block when left and right are equal' );
var tpl2 = Handlebars.compile('{{#greater left right "equal"}}Yup.{{else}}Nope.{{/greater}}');
t.ok( tpl2( data[0] ) === 'Yup.', 'Renders positive block when left is greater, or equal check' );
t.ok( tpl2( data[2] ) === 'Yup.', 'Renders positive block when left and right are equal, or equal check' );
t.ok( tpl2( data.pairs[0] ) === 'Yup.', 'Renders positive block when left is greater, or equal check' );
t.ok( tpl2( data.pairs[2] ) === 'Yup.', 'Renders positive block when left and right are equal, or equal check' );
var tpl3 = Handlebars.compile('{{^greater left right}}Yup.{{else}}Nope.{{/greater}}');
t.ok( tpl3( data[1] ) === 'Yup.', 'Renders positive block when left is less, inverse is used' );
t.ok( tpl3( data[2] ) === 'Yup.', 'Renders positive block when left and right are equal, inverse is used' );
t.ok( tpl3( data.pairs[1] ) === 'Yup.', 'Renders positive block when left is less, inverse is used' );
t.ok( tpl3( data.pairs[2] ) === 'Yup.', 'Renders positive block when left and right are equal, inverse is used' );
var tpl_context = Handlebars.compile('{{#greater 2 1}}{{context}}{{/greater}}');
t.ok( tpl_context( data ) === 'confirmed', 'executes block in parent context' );
});
test( 'less', function( t ){
t.plan(7);
var data = [{
left: 1,
right: 2
}, {
left: 2,
right: 1
}, {
left: 2,
right: 2
}];
t.plan(8);
var data = {
pairs: [{
left: 1,
right: 2
}, {
left: 2,
right: 1
}, {
left: 2,
right: 2
}],
context: 'confirmed'
};
var tpl = Handlebars.compile('{{#less left right}}Yup.{{else}}Nope.{{/less}}');
t.ok( tpl( data[0] ) === 'Yup.', 'Renders positive block when left is less' );
t.ok( tpl( data[1] ) === 'Nope.', 'Renders inverse block when left is less' );
t.ok( tpl( data[2] ) === 'Nope.', 'Renders inverse block when left and right are equal' );
t.ok( tpl( data.pairs[0] ) === 'Yup.', 'Renders positive block when left is less' );
t.ok( tpl( data.pairs[1] ) === 'Nope.', 'Renders inverse block when left is less' );
t.ok( tpl( data.pairs[2] ) === 'Nope.', 'Renders inverse block when left and right are equal' );
var tpl2 = Handlebars.compile('{{#less left right "equal"}}Yup.{{else}}Nope.{{/less}}');
t.ok( tpl2( data[0] ) === 'Yup.', 'Renders positive block when left is less, or equal check' );
t.ok( tpl2( data[2] ) === 'Yup.', 'Renders positive block when left and right are equal, or equal check' );
t.ok( tpl2( data.pairs[0] ) === 'Yup.', 'Renders positive block when left is less, or equal check' );
t.ok( tpl2( data.pairs[2] ) === 'Yup.', 'Renders positive block when left and right are equal, or equal check' );
var tpl3 = Handlebars.compile('{{^less left right}}Yup.{{else}}Nope.{{/less}}');
t.ok( tpl3( data[1] ) === 'Yup.', 'Renders positive block when left is less, inverse is used' );
t.ok( tpl3( data[2] ) === 'Yup.', 'Renders positive block when left and right are equal, inverse is used' );
t.ok( tpl3( data.pairs[1] ) === 'Yup.', 'Renders positive block when left is less, inverse is used' );
t.ok( tpl3( data.pairs[2] ) === 'Yup.', 'Renders positive block when left and right are equal, inverse is used' );
var tpl_context = Handlebars.compile('{{#less 1 2}}{{context}}{{/less}}');
t.ok( tpl_context( data ) === 'confirmed', 'executes block in parent context' );
});

@@ -307,0 +325,0 @@

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc