@budibase/handlebars-helpers
Advanced tools
Comparing version 0.11.11 to 0.12.0
20
index.js
@@ -10,4 +10,2 @@ /*! | ||
var forIn = require('for-in'); | ||
var define = require('define-property'); | ||
var lib = require('./lib/'); | ||
@@ -29,3 +27,3 @@ | ||
var hbs = options.handlebars || options.hbs || require('handlebars'); | ||
define(module.exports, 'handlebars', hbs); | ||
module.exports.handlebars = hbs; | ||
@@ -37,5 +35,6 @@ if (groups) { | ||
} else { | ||
forIn(lib, function(group, key) { | ||
for (const key in lib) { | ||
const group = lib[key]; | ||
hbs.registerHelper(group); | ||
}); | ||
} | ||
} | ||
@@ -49,12 +48,13 @@ | ||
*/ | ||
for (const key in lib) { | ||
const group = lib[key]; | ||
forIn(lib, function(group, key) { | ||
define(module.exports, key, function(options) { | ||
module.exports[key] = function(options) { | ||
options = options || {}; | ||
var hbs = options.handlebars || options.hbs || require('handlebars'); | ||
define(module.exports, 'handlebars', hbs); | ||
module.exports.handlebars = hbs; | ||
hbs.registerHelper(group); | ||
return hbs.helpers; | ||
}); | ||
}); | ||
}; | ||
} | ||
@@ -61,0 +61,0 @@ /** |
@@ -5,3 +5,2 @@ 'use strict'; | ||
var helpers = module.exports; | ||
const arraySort = require('array-sort'); | ||
const getValue = require('get-value'); | ||
@@ -646,3 +645,8 @@ const createFrame = require('./utils/createFrame'); | ||
} | ||
return arraySort.apply(null, args); | ||
if (typeof prop === 'function') { | ||
return array.sort(prop); | ||
} | ||
return array.sort((a, b) => (a[prop] > b[prop] ? 1 : -1)); | ||
} | ||
@@ -649,0 +653,0 @@ return ''; |
@@ -8,3 +8,2 @@ 'use strict'; | ||
var helpers = module.exports; | ||
const kindOf = require('kind-of'); | ||
const htmlTag = require('html-tag'); | ||
@@ -92,3 +91,3 @@ | ||
helpers.js = function(context) { | ||
if (kindOf(context) === 'object') { | ||
if (typeof context === 'object' && context.hash) { | ||
var attr = parseAttr(context.hash); | ||
@@ -98,3 +97,3 @@ return `<script${attr ? ' ' + attr : ''}></script>`; | ||
if (kindOf(context) === 'string') { | ||
if (typeof context === 'string') { | ||
return `<script src="${context}"></script>`; | ||
@@ -101,0 +100,0 @@ } |
@@ -23,3 +23,3 @@ 'use strict'; | ||
url: require('./url'), | ||
uuid: require('./uuid'), | ||
uuid: require('./uuid') | ||
}; |
@@ -74,3 +74,3 @@ 'use strict'; | ||
helpers.typeOf = require('kind-of'); | ||
helpers.typeOf = function(val) { return typeof val; }; | ||
@@ -77,0 +77,0 @@ /** |
@@ -8,3 +8,2 @@ 'use strict'; | ||
const getValue = require('get-value'); | ||
const kindOf = require('kind-of'); | ||
const getObject = require('get-object'); | ||
@@ -188,3 +187,3 @@ const createFrame = require('./utils/createFrame'); | ||
helpers.isObject = function(value) { | ||
return kindOf(value) === 'object'; | ||
return typeof value === 'object'; | ||
}; | ||
@@ -191,0 +190,0 @@ |
'use strict'; | ||
const define = require('define-property'); | ||
const extend = require('extend-shallow'); | ||
module.exports = function createFrame(data) { | ||
@@ -11,8 +8,8 @@ if (typeof(data) !== 'object') { | ||
var frame = extend({}, data); | ||
var frame = Object.assign({}, data); | ||
frame._parent = data; | ||
define(frame, 'extend', function(data) { | ||
extend(this, data); | ||
}); | ||
frame.extend = function(data) { | ||
Object.assign(this, data); | ||
}; | ||
@@ -19,0 +16,0 @@ if (arguments.length > 1) { |
{ | ||
"name": "@budibase/handlebars-helpers", | ||
"description": "More than 130 Handlebars helpers in ~20 categories. Helpers can be used with Assemble, Generate, Verb, Ghost, gulp-handlebars, grunt-handlebars, consolidate, or any node.js/Handlebars project.", | ||
"version": "0.11.11", | ||
"version": "0.12.0", | ||
"homepage": "https://github.com/Budibase/handlebars-helpers", | ||
@@ -78,6 +78,2 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"dependencies": { | ||
"array-sort": "^1.0.0", | ||
"define-property": "^2.0.2", | ||
"extend-shallow": "^3.0.2", | ||
"for-in": "^1.0.2", | ||
"get-object": "^0.2.0", | ||
@@ -91,3 +87,3 @@ "get-value": "^3.0.1", | ||
"kind-of": "^6.0.3", | ||
"micromatch": "^3.1.5", | ||
"micromatch": "^4.0.5", | ||
"relative": "^3.0.2", | ||
@@ -105,3 +101,2 @@ "striptags": "^3.1.1", | ||
"gulp-unused": "^0.2.1", | ||
"helper-coverage": "^0.1.3", | ||
"is-valid-app": "^0.3.0", | ||
@@ -108,0 +103,0 @@ "js-yaml": "^4.1.0", |
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
13
19
190893
28
4067
+ Addedbraces@3.0.3(transitive)
+ Addedfill-range@7.1.1(transitive)
+ Addedis-number@7.0.0(transitive)
+ Addedmicromatch@4.0.8(transitive)
+ Addedpicomatch@2.3.1(transitive)
+ Addedto-regex-range@5.0.1(transitive)
- Removedarray-sort@^1.0.0
- Removeddefine-property@^2.0.2
- Removedextend-shallow@^3.0.2
- Removedfor-in@^1.0.2
- Removedarr-diff@4.0.0(transitive)
- Removedarr-flatten@1.1.0(transitive)
- Removedarr-union@3.1.0(transitive)
- Removedarray-sort@1.0.0(transitive)
- Removedarray-unique@0.3.2(transitive)
- Removedassign-symbols@1.0.0(transitive)
- Removedatob@2.1.2(transitive)
- Removedbase@0.11.2(transitive)
- Removedbraces@2.3.2(transitive)
- Removedcache-base@1.0.1(transitive)
- Removedclass-utils@0.3.6(transitive)
- Removedcollection-visit@1.0.0(transitive)
- Removedcomponent-emitter@1.3.1(transitive)
- Removedcopy-descriptor@0.1.1(transitive)
- Removeddebug@2.6.9(transitive)
- Removeddecode-uri-component@0.2.2(transitive)
- Removeddefault-compare@1.0.0(transitive)
- Removeddefine-property@0.2.51.0.02.0.2(transitive)
- Removedexpand-brackets@2.1.4(transitive)
- Removedextend-shallow@2.0.13.0.2(transitive)
- Removedextglob@2.0.4(transitive)
- Removedfill-range@4.0.0(transitive)
- Removedfor-in@1.0.2(transitive)
- Removedfragment-cache@0.2.1(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedget-value@2.0.6(transitive)
- Removedhas-value@0.3.11.0.0(transitive)
- Removedhas-values@0.1.41.0.0(transitive)
- Removedhasown@2.0.2(transitive)
- Removedis-accessor-descriptor@1.0.1(transitive)
- Removedis-data-descriptor@1.0.1(transitive)
- Removedis-descriptor@0.1.71.0.3(transitive)
- Removedis-extendable@0.1.11.0.1(transitive)
- Removedis-number@3.0.0(transitive)
- Removedis-plain-object@2.0.4(transitive)
- Removedis-windows@1.0.2(transitive)
- Removedkind-of@4.0.05.1.0(transitive)
- Removedmap-cache@0.2.2(transitive)
- Removedmap-visit@1.0.0(transitive)
- Removedmicromatch@3.1.10(transitive)
- Removedmixin-deep@1.3.2(transitive)
- Removedms@2.0.0(transitive)
- Removednanomatch@1.2.13(transitive)
- Removedobject-copy@0.1.0(transitive)
- Removedobject-visit@1.0.1(transitive)
- Removedobject.pick@1.3.0(transitive)
- Removedpascalcase@0.1.1(transitive)
- Removedposix-character-classes@0.1.1(transitive)
- Removedregex-not@1.0.2(transitive)
- Removedrepeat-element@1.1.4(transitive)
- Removedrepeat-string@1.6.1(transitive)
- Removedresolve-url@0.2.1(transitive)
- Removedret@0.1.15(transitive)
- Removedsafe-regex@1.1.0(transitive)
- Removedset-value@2.0.1(transitive)
- Removedsnapdragon@0.8.2(transitive)
- Removedsnapdragon-node@2.1.1(transitive)
- Removedsnapdragon-util@3.0.1(transitive)
- Removedsource-map@0.5.7(transitive)
- Removedsource-map-resolve@0.5.3(transitive)
- Removedsource-map-url@0.4.1(transitive)
- Removedsplit-string@3.1.0(transitive)
- Removedstatic-extend@0.1.2(transitive)
- Removedto-object-path@0.3.0(transitive)
- Removedto-regex@3.0.2(transitive)
- Removedto-regex-range@2.1.1(transitive)
- Removedunion-value@1.0.1(transitive)
- Removedunset-value@1.0.0(transitive)
- Removedurix@0.1.0(transitive)
- Removeduse@3.1.1(transitive)
Updatedmicromatch@^4.0.5