Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

layouts

Package Overview
Dependencies
Maintainers
2
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

layouts - npm Package Compare versions

Comparing version 0.2.7 to 0.2.8

test/assertLayout.js

18

index.js

@@ -165,7 +165,10 @@ /*!

Layouts.prototype.assertLayout = function (value) {
if (!value || isFalsey(value)) {
Layouts.prototype.assertLayout = function (value, defaultLayout) {
if (value === false || (value && isFalsey(value))) {
return null;
} else if (!value || value === true) {
return defaultLayout || null;
} else {
return value;
}
return value;
};

@@ -204,4 +207,5 @@

Layouts.prototype.createStack = function (name) {
name = this.assertLayout(name);
Layouts.prototype.createStack = function (name, options) {
var opts = _.extend({}, this.options, options);
name = this.assertLayout(name, opts.defaultLayout);
var template = Object.create(null);

@@ -212,3 +216,3 @@ var stack = [];

stack.unshift(name);
name = this.assertLayout(template.layout);
name = this.assertLayout(template.layout, opts.defaultLayout);
}

@@ -236,3 +240,3 @@ return stack;

Layouts.prototype.stack = function (name, options) {
var stack = this.createStack(name);
var stack = this.createStack(name, options);
var opts = _.extend(this.options, options);

@@ -239,0 +243,0 @@ var data = {};

{
"name": "layouts",
"description": "Wrap templates with layouts. Layouts can be nested and optionally use other layouts.",
"version": "0.2.7",
"version": "0.2.8",
"homepage": "https://github.com/jonschlinkert/layouts",

@@ -6,0 +6,0 @@ "author": {

@@ -14,14 +14,14 @@ /*!

describe('.stack():', function () {
describe('.stack() with properties:', function () {
describe('when layouts are defined as objects with their own properties:', function () {
var layouts = new Layouts();
layouts.set({first: { layout: 'a', content: '{{body}}' }});
layouts.set({a: { layout: 'b', a: 'b', title: 'A', content: '{{ title }} above\n{{body}}\n{{ title }} below' }});
layouts.set({b: { layout: 'c', c: 'd', title: 'B', content: '{{ title }} above\n{{body}}\n{{ title }} below' }});
layouts.set({c: { layout: 'd', e: 'f', title: 'C', content: '{{ title }} above\n{{body}}\n{{ title }} below' }});
layouts.set({d: { layout: 'e', g: 'h', title: 'D', content: '{{ title }} above\n{{body}}\n{{ title }} below' }});
layouts.set({e: { layout: 'f', i: 'j', title: 'E', content: '{{ title }} above\n{{body}}\n{{ title }} below' }});
layouts.set({f: { layout: 'last', data: {one: 'two'}, title: 'F', content: '{{ title }} above\n{{body}}\n{{ title }} below' }});
layouts.set({last: { layout: undefined, content: 'last!\n{{body}}\nlast!' }});
layouts.setLayout({first: { layout: 'a', content: '{{body}}' }});
layouts.setLayout({a: { layout: 'b', a: 'b', title: 'A', content: '{{ title }} above\n{{body}}\n{{ title }} below' }});
layouts.setLayout({b: { layout: 'c', c: 'd', title: 'B', content: '{{ title }} above\n{{body}}\n{{ title }} below' }});
layouts.setLayout({c: { layout: 'd', e: 'f', title: 'C', content: '{{ title }} above\n{{body}}\n{{ title }} below' }});
layouts.setLayout({d: { layout: 'e', g: 'h', title: 'D', content: '{{ title }} above\n{{body}}\n{{ title }} below' }});
layouts.setLayout({e: { layout: 'f', i: 'j', title: 'E', content: '{{ title }} above\n{{body}}\n{{ title }} below' }});
layouts.setLayout({f: { layout: 'last', data: {one: 'two'}, title: 'F', content: '{{ title }} above\n{{body}}\n{{ title }} below' }});
layouts.setLayout({last: { layout: undefined, content: 'last!\n{{body}}\nlast!' }});

@@ -64,15 +64,15 @@ it('should return a layout stack.', function () {

xdescribe('when layouts are defined with string values:', function () {
describe('when layouts are defined with string values:', function () {
var layouts = new Layouts();
layouts.set('first', 'a', '{{body}}');
layouts.set('a', 'b', 'A above\n{{body}}\nA below');
layouts.set('b', 'c', 'B above\n{{body}}\nB below');
layouts.set('c', 'd', 'C above\n{{body}}\nC below');
layouts.set('d', 'e', 'D above\n{{body}}\nD below');
layouts.set('e', 'f', 'E above\n{{body}}\nE below');
layouts.set('f', 'last', 'F above\n{{body}}\nF below');
layouts.set('last', undefined, 'last!\n{{body}}\nlast!');
layouts.setLayout('first', 'a', '{{body}}');
layouts.setLayout('a', 'b', 'A above\n{{body}}\nA below');
layouts.setLayout('b', 'c', 'B above\n{{body}}\nB below');
layouts.setLayout('c', 'd', 'C above\n{{body}}\nC below');
layouts.setLayout('d', 'e', 'D above\n{{body}}\nD below');
layouts.setLayout('e', 'f', 'E above\n{{body}}\nE below');
layouts.setLayout('f', 'last', 'F above\n{{body}}\nF below');
layouts.setLayout('last', undefined, 'last!\n{{body}}\nlast!');
xit('should build a layout stack', function () {
it('should build a layout stack', function () {
var actual = layouts.stack('first');

@@ -96,2 +96,3 @@ var expected = [

].join('\n');
actual.content.should.eql(expected);

@@ -98,0 +99,0 @@ });

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