Comparing version 0.10.1 to 0.10.2
22
index.js
'use strict'; | ||
var isFalsey = require('falsey'); | ||
var Buffer = require('buffer').Buffer; | ||
var delims = require('delimiter-regex'); | ||
var get = require('get-value'); | ||
var lazy = require('lazy-cache')(require); | ||
lazy('falsey', 'isFalsey'); | ||
lazy('is-buffer', 'isBuffer'); | ||
lazy('delimiter-regex', 'delims'); | ||
lazy('get-value', 'get'); | ||
@@ -40,3 +41,3 @@ /** | ||
function renderLayouts(str, name, layoutStack, opts, fn) { | ||
if (isBuffer(str)) { | ||
if (lazy.isBuffer(str)) { | ||
str = str.toString(); | ||
@@ -115,3 +116,3 @@ } | ||
function assertLayout(value, defaultLayout) { | ||
if (value === false || (value && isFalsey(value))) { | ||
if (value === false || (value && lazy.isFalsey(value))) { | ||
return null; | ||
@@ -134,3 +135,3 @@ } else if (!value || value === true) { | ||
if (tagName.indexOf('.') !== -1) { | ||
return toString(get(data, tagName.trim())); | ||
return toString(lazy.get(data, tagName.trim())); | ||
} | ||
@@ -161,3 +162,3 @@ return data[tagName.trim()]; | ||
if (Array.isArray(syntax)) { | ||
return (cache[syntax] = delims(syntax)); | ||
return (cache[syntax] = lazy.delims(syntax)); | ||
} | ||
@@ -173,6 +174,1 @@ } | ||
} | ||
function isBuffer(val) { | ||
return typeof val === 'object' | ||
&& val instanceof Buffer; | ||
} |
{ | ||
"name": "layouts", | ||
"description": "Wraps templates with layouts. Layouts can use other layouts and be nested to any depth. This can be used 100% standalone to wrap any kind of file with banners, headers or footer content. Use for markdown, HTML, handlebars views, lo-dash templates, etc. Layouts can also be vinyl files.", | ||
"version": "0.10.1", | ||
"version": "0.10.2", | ||
"homepage": "https://github.com/doowb/layouts", | ||
@@ -23,8 +23,15 @@ "author": "Brian Woodward (https://github.com/doowb)", | ||
"scripts": { | ||
"test": "mocha" | ||
"test": "mocha", | ||
"prepublish": "browserify -o browser.js -e index.js -s index --bare" | ||
}, | ||
"dependencies": { | ||
"delimiter-regex": "^1.3.1", | ||
"extend-shallow": "^2.0.1", | ||
"falsey": "^0.2.1", | ||
"get-value": "^1.1.5" | ||
"get-value": "^1.1.5", | ||
"is-buffer": "^1.0.2", | ||
"isobject": "^2.0.0", | ||
"kind-of": "^2.0.0", | ||
"lazy-cache": "^0.2.3", | ||
"noncharacters": "^1.1.0" | ||
}, | ||
@@ -31,0 +38,0 @@ "devDependencies": { |
12657
9
142
+ Addedextend-shallow@^2.0.1
+ Addedis-buffer@^1.0.2
+ Addedisobject@^2.0.0
+ Addedkind-of@^2.0.0
+ Addedlazy-cache@^0.2.3
+ Addednoncharacters@^1.1.0
+ Addedextend-shallow@2.0.1(transitive)
+ Addedis-buffer@1.1.6(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedisobject@2.1.0(transitive)
+ Addedkind-of@2.0.1(transitive)