handlebars-subexpression-helpers
Advanced tools
Comparing version 1.0.5 to 1.0.6
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
value: true | ||
}); | ||
var register = exports.register = function register(Handlebars) { | ||
Handlebars.registerHelper('and', function () { | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
Handlebars.registerHelper('and', function () { | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
var result = true; | ||
var result = true; | ||
args && args.forEach(function (val) { | ||
args && args.forEach(function (val) { | ||
if (!!val === false) { | ||
result = false; | ||
return; | ||
} | ||
}); | ||
if (!!val === false) { | ||
result = false; | ||
return; | ||
} | ||
}); | ||
return result; | ||
}); | ||
return result; | ||
}); | ||
}; |
@@ -13,5 +13,5 @@ 'use strict'; | ||
return args.filter(function (arg) { | ||
return typeof arg === 'string' || typeof arg === 'number'; | ||
return typeof arg === 'string'; | ||
}).join(''); | ||
}); | ||
}; |
@@ -10,3 +10,3 @@ 'use strict'; | ||
if (typeof needle !== 'string' && typeof needle !== 'numeric') { | ||
if (typeof needle !== 'string' && typeof needle !== 'number') { | ||
return false; | ||
@@ -13,0 +13,0 @@ } |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var register = exports.register = function register(Handlebars) { | ||
Handlebars.registerHelper('includes', function (haystack, needle) { | ||
Handlebars.registerHelper('includes', function (haystack, needle) { | ||
if (typeof needle !== 'string' && typeof needle !== 'numeric') { | ||
return false; | ||
} | ||
if (typeof needle !== 'string' && typeof needle !== 'numeric') { | ||
return false; | ||
} | ||
if (['string', 'numeric'].indexOf(typeof haystack === 'undefined' ? 'undefined' : _typeof(haystack)) !== -1) { | ||
if (['string', 'numeric'].indexOf(typeof haystack === 'undefined' ? 'undefined' : _typeof(haystack)) !== -1) { | ||
return haystack.toString().includes(needle); | ||
} else if (Object.prototype.toString.call(haystack) === '[object Array]') { | ||
return haystack.toString().includes(needle); | ||
} else if (Object.prototype.toString.call(haystack) === '[object Array]') { | ||
return haystack.indexOf(needle) !== -1; | ||
} | ||
return haystack.indexOf(needle) !== -1; | ||
} | ||
return false; | ||
}); | ||
return false; | ||
}); | ||
}; |
'use strict'; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | ||
var register = exports.register = function register(Handlebars) { | ||
@@ -9,0 +10,0 @@ Handlebars.registerHelper('isObject', function (value) { |
'use strict'; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | ||
var register = exports.register = function register(Handlebars) { | ||
@@ -9,0 +10,0 @@ Handlebars.registerHelper('typeof', function (value) { |
@@ -0,0 +0,0 @@ var path = require('path'); |
module.exports.register = function(Handlebars) { | ||
require('./dist/index').register(Handlebars); | ||
}; |
{ | ||
"name": "handlebars-subexpression-helpers", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "Some simple yet useful subexpression helpers for handlebars", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -0,0 +0,0 @@ # handlebars-subexpression-helpers |
@@ -0,0 +0,0 @@ import path from "path"; |
@@ -0,0 +0,0 @@ export let register = (Handlebars) => { |
export let register = (Handlebars) => { | ||
Handlebars.registerHelper('concat', (...args) => args.filter((arg) => typeof arg === 'string' || typeof arg === 'number').join('')); | ||
Handlebars.registerHelper('concat', (...args) => args.filter((arg) => typeof arg === 'string').join('')); | ||
}; |
@@ -0,0 +0,0 @@ export let register = (Handlebars) => { |
@@ -5,3 +5,3 @@ export let register = (Handlebars) => { | ||
if(typeof needle !== 'string' && typeof needle !== 'numeric') { | ||
if(typeof needle !== 'string' && typeof needle !== 'number') { | ||
return false; | ||
@@ -8,0 +8,0 @@ } |
@@ -0,0 +0,0 @@ export let register = (Handlebars) => { |
export let register = (Handlebars) => { | ||
Handlebars.registerHelper('isArray', (value) => Object.prototype.toString.call(value) === '[object Array]'); | ||
}; |
export let register = (Handlebars) => { | ||
Handlebars.registerHelper('isEqual', (arg1, arg2) => arg1 == arg2); | ||
}; |
export let register = (Handlebars) => { | ||
Handlebars.registerHelper('isFalse', (arg) => arg === false); | ||
}; |
export let register = (Handlebars) => { | ||
Handlebars.registerHelper('isFalsy', (arg) => !!arg === false); | ||
}; |
export let register = (Handlebars) => { | ||
Handlebars.registerHelper('isObject', (value) => typeof value === 'object' && value !== null); | ||
}; |
export let register = (Handlebars) => { | ||
Handlebars.registerHelper('isTrue', (arg) => arg === true); | ||
}; |
export let register = (Handlebars) => { | ||
Handlebars.registerHelper('isTruthy', (arg) => !!arg === true); | ||
}; |
export let register = (Handlebars) => { | ||
Handlebars.registerHelper('not', (arg1) => !arg1); | ||
}; |
export let register = (Handlebars) => { | ||
Handlebars.registerHelper('plainText', (html) => html.replace(/(<([^>]+)>)/ig,"").replace(/\n{1,}/g,' ')); | ||
}; |
@@ -0,0 +0,0 @@ export let register = (Handlebars) => { |
export let register = (Handlebars) => { | ||
Handlebars.registerHelper('twitterHandle', (twitter) => twitter.replace(/^https?:\/\/(www\.)?twitter.com\/(.*)/,'$2').replace(/^@(.*)/,'$1')); | ||
}; |
export let register = (Handlebars) => { | ||
Handlebars.registerHelper('typeof', (value) => typeof value); | ||
}; |
@@ -0,0 +0,0 @@ import assert from "assert"; |
@@ -0,0 +0,0 @@ import assert from "assert"; |
@@ -0,0 +0,0 @@ import assert from "assert"; |
@@ -0,0 +0,0 @@ import assert from "assert"; |
@@ -0,0 +0,0 @@ import assert from "assert"; |
@@ -0,0 +0,0 @@ import assert from "assert"; |
@@ -0,0 +0,0 @@ import assert from "assert"; |
@@ -0,0 +0,0 @@ import assert from "assert"; |
@@ -0,0 +0,0 @@ import assert from "assert"; |
@@ -0,0 +0,0 @@ import assert from "assert"; |
@@ -0,0 +0,0 @@ import assert from "assert"; |
@@ -0,0 +0,0 @@ import assert from "assert"; |
@@ -0,0 +0,0 @@ import assert from "assert"; |
@@ -0,0 +0,0 @@ import assert from "assert"; |
@@ -0,0 +0,0 @@ import assert from "assert"; |
@@ -0,0 +0,0 @@ import assert from "assert"; |
@@ -0,0 +0,0 @@ import assert from "assert"; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35417
64
785