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

twiq

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

twiq - npm Package Compare versions

Comparing version 1.4.0 to 1.4.1

.editorconfig

6

dist/twiq.d.ts

@@ -1,2 +0,2 @@

interface Template7{
interface Twiq{
global?: any

@@ -11,4 +11,4 @@ templates?: any;

declare const Template7 : Template7;
declare const Twiq : Twiq;
export default Template7
export default Twiq
/**
* Template7 0.4.0
* Twiq 1.4.0
* Mobile-first HTML template engine
*
* http://www.sweet.io/template7/
* http://www.sweet.io/twiq/
*

@@ -24,5 +24,5 @@ * Copyright 2018, John Doe

const Template7Context = t7ctx;
const TwiqContext = t7ctx;
const Template7Utils = {
const TwiqUtils = {
quoteSingleRexExp: new RegExp('\'', 'g'),

@@ -34,4 +34,4 @@ quoteDoubleRexExp: new RegExp('"', 'g'),

escape(string) {
return (typeof Template7Context !== 'undefined' && Template7Context.escape) ?
Template7Context.escape(string) :
return (typeof TwiqContext !== 'undefined' && TwiqContext.escape) ?
TwiqContext.escape(string) :
string

@@ -44,3 +44,3 @@ .replace(/&/g, '&')

helperToSlices(string) {
const { quoteDoubleRexExp, quoteSingleRexExp } = Template7Utils;
const { quoteDoubleRexExp, quoteSingleRexExp } = TwiqUtils;
const helperParts = string.replace(/[{}#}]/g, '').trim().split(' ');

@@ -135,3 +135,3 @@ const slices = [];

// Helpers
const helperSlices = Template7Utils.helperToSlices(block);
const helperSlices = TwiqUtils.helperToSlices(block);
let helperName = helperSlices[0];

@@ -270,3 +270,3 @@ const isPartial = helperName === '>';

} else if (name.indexOf('@global') === 0) {
variable = 'Template7.global';
variable = 'Twiq.global';
parts = name.split('@global.')[1].split('.');

@@ -291,3 +291,3 @@ } else if (name.indexOf('@root') === 0) {

}
} else if (Number.isFinite ? Number.isFinite(part) : Template7Context.isFinite(part)) {
} else if (Number.isFinite ? Number.isFinite(part) : TwiqContext.isFinite(part)) {
variable += `[${part}]`;

@@ -308,3 +308,3 @@ } else if (part === 'this' || part.indexOf('this.') >= 0 || part.indexOf('this[') >= 0 || part.indexOf('this(') >= 0) {

else {
arr.push(Template7Utils.getCompileVar(contextArray[i], ctx, data));
arr.push(TwiqUtils.getCompileVar(contextArray[i], ctx, data));
}

@@ -318,9 +318,9 @@ }

/* eslint no-eval: "off" */
const Template7Helpers = {
const TwiqHelpers = {
_partial(partialName, options) {
const ctx = this;
const p = Template7Class.partials[partialName];
const p = TwiqClass.partials[partialName];
if (!p || (p && !p.template)) return '';
if (!p.compiled) {
p.compiled = new Template7Class(p.template).compile();
p.compiled = new TwiqClass(p.template).compile();
}

@@ -334,9 +334,9 @@ Object.keys(options.hash).forEach((hashName) => {

if (typeof context !== 'string') {
throw new Error('Template7: Passed context to "escape" helper should be a string');
throw new Error('Twiq: Passed context to "escape" helper should be a string');
}
return Template7Utils.escape(context);
return TwiqUtils.escape(context);
},
if(context, options) {
let ctx = context;
if (Template7Utils.isFunction(ctx)) { ctx = ctx.call(this); }
if (TwiqUtils.isFunction(ctx)) { ctx = ctx.call(this); }
if (ctx) {

@@ -350,3 +350,3 @@ return options.fn(this, options.data);

let ctx = context;
if (Template7Utils.isFunction(ctx)) { ctx = ctx.call(this); }
if (TwiqUtils.isFunction(ctx)) { ctx = ctx.call(this); }
if (!ctx) {

@@ -362,3 +362,3 @@ return options.fn(this, options.data);

let i = 0;
if (Template7Utils.isFunction(ctx)) { ctx = ctx.call(this); }
if (TwiqUtils.isFunction(ctx)) { ctx = ctx.call(this); }
if (Array.isArray(ctx)) {

@@ -386,3 +386,3 @@ if (options.hash.reverse) {

let ctx = context;
if (Template7Utils.isFunction(ctx)) { ctx = context.call(this); }
if (TwiqUtils.isFunction(ctx)) { ctx = context.call(this); }
return options.fn(ctx);

@@ -392,3 +392,3 @@ },

let ctx = context;
if (Template7Utils.isFunction(ctx)) { ctx = ctx.call(this); }
if (TwiqUtils.isFunction(ctx)) { ctx = ctx.call(this); }
return ctx.join(options.hash.delimiter || options.hash.delimeter);

@@ -410,9 +410,9 @@ },

if (options.root && execute.indexOf('@root') >= 0) {
execute = Template7Utils.parseJsVariable(execute, '@root', options.root);
execute = TwiqUtils.parseJsVariable(execute, '@root', options.root);
}
if (execute.indexOf('@global') >= 0) {
execute = Template7Utils.parseJsVariable(execute, '@global', Template7Context.Template7.global);
execute = TwiqUtils.parseJsVariable(execute, '@global', TwiqContext.Twiq.global);
}
if (execute.indexOf('../') >= 0) {
execute = Template7Utils.parseJsParents(execute, options.parents);
execute = TwiqUtils.parseJsParents(execute, options.parents);
}

@@ -440,9 +440,9 @@ if (execute.indexOf('return') >= 0) {

if (options.root && execute.indexOf('@root') >= 0) {
execute = Template7Utils.parseJsVariable(execute, '@root', options.root);
execute = TwiqUtils.parseJsVariable(execute, '@root', options.root);
}
if (execute.indexOf('@global') >= 0) {
execute = Template7Utils.parseJsVariable(execute, '@global', Template7Context.Template7.global);
execute = TwiqUtils.parseJsVariable(execute, '@global', TwiqContext.Twiq.global);
}
if (execute.indexOf('../') >= 0) {
execute = Template7Utils.parseJsParents(execute, options.parents);
execute = TwiqUtils.parseJsParents(execute, options.parents);
}

@@ -462,8 +462,8 @@ if (execute.indexOf('return') >= 0) {

};
Template7Helpers.js_compare = Template7Helpers.js_if;
TwiqHelpers.js_compare = TwiqHelpers.js_if;
const Template7Options = {};
const Template7Partials = {};
const TwiqOptions = {};
const TwiqPartials = {};
class Template7Class {
class TwiqClass {
constructor(template) {

@@ -478,5 +478,5 @@ const t = this;

if (typeof template !== 'string') {
throw new Error('Template7: Template must be a string');
throw new Error('Twiq: Template must be a string');
}
const { stringToBlocks, getCompileVar, getCompiledArguments } = Template7Utils;
const { stringToBlocks, getCompileVar, getCompiledArguments } = TwiqUtils;

@@ -546,7 +546,7 @@ const blocks = stringToBlocks(template);

}
if (dynamicHelper || block.helperName in Template7Helpers) {
if (dynamicHelper || block.helperName in TwiqHelpers) {
compiledArguments = getCompiledArguments(block.contextName, ctx, data);
resultString += `r += (Template7Helpers${dynamicHelper ? `[${block.helperName}]` : `.${block.helperName}`}).call(${ctx}, ${compiledArguments && (`${compiledArguments}, `)}{hash:${JSON.stringify(block.hash)}, data: ${data} || {}, fn: ${getCompileFn(block, depth + 1)}, inverse: ${getCompileInverse(block, depth + 1)}, root: root, parents: ${parents}});`;
resultString += `r += (TwiqHelpers${dynamicHelper ? `[${block.helperName}]` : `.${block.helperName}`}).call(${ctx}, ${compiledArguments && (`${compiledArguments}, `)}{hash:${JSON.stringify(block.hash)}, data: ${data} || {}, fn: ${getCompileFn(block, depth + 1)}, inverse: ${getCompileInverse(block, depth + 1)}, root: root, parents: ${parents}});`;
} else if (block.contextName.length > 0) {
throw new Error(`Template7: Missing helper: "${block.helperName}"`);
throw new Error(`Twiq: Missing helper: "${block.helperName}"`);
} else {

@@ -556,5 +556,5 @@ variable = getCompileVar(block.helperName, ctx, data);

resultString += `if (isArray(${variable})) {`;
resultString += `r += (Template7Helpers.each).call(${ctx}, ${variable}, {hash:${JSON.stringify(block.hash)}, data: ${data} || {}, fn: ${getCompileFn(block, depth + 1)}, inverse: ${getCompileInverse(block, depth + 1)}, root: root, parents: ${parents}});`;
resultString += `r += (TwiqHelpers.each).call(${ctx}, ${variable}, {hash:${JSON.stringify(block.hash)}, data: ${data} || {}, fn: ${getCompileFn(block, depth + 1)}, inverse: ${getCompileInverse(block, depth + 1)}, root: root, parents: ${parents}});`;
resultString += '}else {';
resultString += `r += (Template7Helpers.with).call(${ctx}, ${variable}, {hash:${JSON.stringify(block.hash)}, data: ${data} || {}, fn: ${getCompileFn(block, depth + 1)}, inverse: ${getCompileInverse(block, depth + 1)}, root: root, parents: ${parents}});`;
resultString += `r += (TwiqHelpers.with).call(${ctx}, ${variable}, {hash:${JSON.stringify(block.hash)}, data: ${data} || {}, fn: ${getCompileFn(block, depth + 1)}, inverse: ${getCompileInverse(block, depth + 1)}, root: root, parents: ${parents}});`;
resultString += '}}';

@@ -574,16 +574,16 @@ }

static get options() {
return Template7Options;
return TwiqOptions;
}
static get partials() {
return Template7Partials;
return TwiqPartials;
}
static get helpers() {
return Template7Helpers;
return TwiqHelpers;
}
}
function Template7(...args) {
function Twiq(...args) {
const [template, data] = args;
if (args.length === 2) {
let instance = new Template7Class(template);
let instance = new TwiqClass(template);
const rendered = instance.compile()(data);

@@ -593,29 +593,29 @@ instance = null;

}
return new Template7Class(template);
return new TwiqClass(template);
}
Template7.registerHelper = function registerHelper(name, fn) {
Template7Class.helpers[name] = fn;
Twiq.registerHelper = function registerHelper(name, fn) {
TwiqClass.helpers[name] = fn;
};
Template7.unregisterHelper = function unregisterHelper(name) {
Template7Class.helpers[name] = undefined;
delete Template7Class.helpers[name];
Twiq.unregisterHelper = function unregisterHelper(name) {
TwiqClass.helpers[name] = undefined;
delete TwiqClass.helpers[name];
};
Template7.registerPartial = function registerPartial(name, template) {
Template7Class.partials[name] = { template };
Twiq.registerPartial = function registerPartial(name, template) {
TwiqClass.partials[name] = { template };
};
Template7.unregisterPartial = function unregisterPartial(name) {
if (Template7Class.partials[name]) {
Template7Class.partials[name] = undefined;
delete Template7Class.partials[name];
Twiq.unregisterPartial = function unregisterPartial(name) {
if (TwiqClass.partials[name]) {
TwiqClass.partials[name] = undefined;
delete TwiqClass.partials[name];
}
};
Template7.compile = function compile(template, options) {
const instance = new Template7Class(template, options);
Twiq.compile = function compile(template, options) {
const instance = new TwiqClass(template, options);
return instance.compile();
};
Template7.options = Template7Class.options;
Template7.helpers = Template7Class.helpers;
Template7.partials = Template7Class.partials;
Twiq.options = TwiqClass.options;
Twiq.helpers = TwiqClass.helpers;
Twiq.partials = TwiqClass.partials;
export default Template7;
export default Twiq;
/**
* Template7 0.4.0
* Twiq 1.4.0
* Mobile-first HTML template engine
*
* http://www.sweet.io/template7/
* http://www.sweet.io/twiq/
*

@@ -18,3 +18,3 @@ * Copyright 2018, John Doe

typeof define === 'function' && define.amd ? define(factory) :
(global.Template7 = factory());
(global.Twiq = factory());
}(this, (function () { 'use strict';

@@ -31,5 +31,5 @@

var Template7Context = t7ctx;
var TwiqContext = t7ctx;
var Template7Utils = {
var TwiqUtils = {
quoteSingleRexExp: new RegExp('\'', 'g'),

@@ -41,4 +41,4 @@ quoteDoubleRexExp: new RegExp('"', 'g'),

escape: function escape(string) {
return (typeof Template7Context !== 'undefined' && Template7Context.escape) ?
Template7Context.escape(string) :
return (typeof TwiqContext !== 'undefined' && TwiqContext.escape) ?
TwiqContext.escape(string) :
string

@@ -51,4 +51,4 @@ .replace(/&/g, '&')

helperToSlices: function helperToSlices(string) {
var quoteDoubleRexExp = Template7Utils.quoteDoubleRexExp;
var quoteSingleRexExp = Template7Utils.quoteSingleRexExp;
var quoteDoubleRexExp = TwiqUtils.quoteDoubleRexExp;
var quoteSingleRexExp = TwiqUtils.quoteSingleRexExp;
var helperParts = string.replace(/[{}#}]/g, '').trim().split(' ');

@@ -143,3 +143,3 @@ var slices = [];

// Helpers
var helperSlices = Template7Utils.helperToSlices(block);
var helperSlices = TwiqUtils.helperToSlices(block);
var helperName = helperSlices[0];

@@ -280,3 +280,3 @@ var isPartial = helperName === '>';

} else if (name.indexOf('@global') === 0) {
variable = 'Template7.global';
variable = 'Twiq.global';
parts = name.split('@global.')[1].split('.');

@@ -301,3 +301,3 @@ } else if (name.indexOf('@root') === 0) {

}
} else if (Number.isFinite ? Number.isFinite(part) : Template7Context.isFinite(part)) {
} else if (Number.isFinite ? Number.isFinite(part) : TwiqContext.isFinite(part)) {
variable += "[" + part + "]";

@@ -318,3 +318,3 @@ } else if (part === 'this' || part.indexOf('this.') >= 0 || part.indexOf('this[') >= 0 || part.indexOf('this(') >= 0) {

else {
arr.push(Template7Utils.getCompileVar(contextArray[i], ctx, data));
arr.push(TwiqUtils.getCompileVar(contextArray[i], ctx, data));
}

@@ -328,9 +328,9 @@ }

/* eslint no-eval: "off" */
var Template7Helpers = {
var TwiqHelpers = {
_partial: function _partial(partialName, options) {
var ctx = this;
var p = Template7Class.partials[partialName];
var p = TwiqClass.partials[partialName];
if (!p || (p && !p.template)) { return ''; }
if (!p.compiled) {
p.compiled = new Template7Class(p.template).compile();
p.compiled = new TwiqClass(p.template).compile();
}

@@ -344,9 +344,9 @@ Object.keys(options.hash).forEach(function (hashName) {

if (typeof context !== 'string') {
throw new Error('Template7: Passed context to "escape" helper should be a string');
throw new Error('Twiq: Passed context to "escape" helper should be a string');
}
return Template7Utils.escape(context);
return TwiqUtils.escape(context);
},
if: function if$1(context, options) {
var ctx = context;
if (Template7Utils.isFunction(ctx)) { ctx = ctx.call(this); }
if (TwiqUtils.isFunction(ctx)) { ctx = ctx.call(this); }
if (ctx) {

@@ -360,3 +360,3 @@ return options.fn(this, options.data);

var ctx = context;
if (Template7Utils.isFunction(ctx)) { ctx = ctx.call(this); }
if (TwiqUtils.isFunction(ctx)) { ctx = ctx.call(this); }
if (!ctx) {

@@ -372,3 +372,3 @@ return options.fn(this, options.data);

var i = 0;
if (Template7Utils.isFunction(ctx)) { ctx = ctx.call(this); }
if (TwiqUtils.isFunction(ctx)) { ctx = ctx.call(this); }
if (Array.isArray(ctx)) {

@@ -396,3 +396,3 @@ if (options.hash.reverse) {

var ctx = context;
if (Template7Utils.isFunction(ctx)) { ctx = context.call(this); }
if (TwiqUtils.isFunction(ctx)) { ctx = context.call(this); }
return options.fn(ctx);

@@ -402,3 +402,3 @@ },

var ctx = context;
if (Template7Utils.isFunction(ctx)) { ctx = ctx.call(this); }
if (TwiqUtils.isFunction(ctx)) { ctx = ctx.call(this); }
return ctx.join(options.hash.delimiter || options.hash.delimeter);

@@ -420,9 +420,9 @@ },

if (options.root && execute.indexOf('@root') >= 0) {
execute = Template7Utils.parseJsVariable(execute, '@root', options.root);
execute = TwiqUtils.parseJsVariable(execute, '@root', options.root);
}
if (execute.indexOf('@global') >= 0) {
execute = Template7Utils.parseJsVariable(execute, '@global', Template7Context.Template7.global);
execute = TwiqUtils.parseJsVariable(execute, '@global', TwiqContext.Twiq.global);
}
if (execute.indexOf('../') >= 0) {
execute = Template7Utils.parseJsParents(execute, options.parents);
execute = TwiqUtils.parseJsParents(execute, options.parents);
}

@@ -450,9 +450,9 @@ if (execute.indexOf('return') >= 0) {

if (options.root && execute.indexOf('@root') >= 0) {
execute = Template7Utils.parseJsVariable(execute, '@root', options.root);
execute = TwiqUtils.parseJsVariable(execute, '@root', options.root);
}
if (execute.indexOf('@global') >= 0) {
execute = Template7Utils.parseJsVariable(execute, '@global', Template7Context.Template7.global);
execute = TwiqUtils.parseJsVariable(execute, '@global', TwiqContext.Twiq.global);
}
if (execute.indexOf('../') >= 0) {
execute = Template7Utils.parseJsParents(execute, options.parents);
execute = TwiqUtils.parseJsParents(execute, options.parents);
}

@@ -472,8 +472,8 @@ if (execute.indexOf('return') >= 0) {

};
Template7Helpers.js_compare = Template7Helpers.js_if;
TwiqHelpers.js_compare = TwiqHelpers.js_if;
var Template7Options = {};
var Template7Partials = {};
var TwiqOptions = {};
var TwiqPartials = {};
var Template7Class = function Template7Class(template) {
var TwiqClass = function TwiqClass(template) {
var t = this;

@@ -484,3 +484,3 @@ t.template = template;

var staticAccessors = { options: { configurable: true },partials: { configurable: true },helpers: { configurable: true } };
Template7Class.prototype.compile = function compile (template, depth) {
TwiqClass.prototype.compile = function compile (template, depth) {
if ( template === void 0 ) template = this.template;

@@ -493,7 +493,7 @@ if ( depth === void 0 ) depth = 1;

if (typeof template !== 'string') {
throw new Error('Template7: Template must be a string');
throw new Error('Twiq: Template must be a string');
}
var stringToBlocks = Template7Utils.stringToBlocks;
var getCompileVar = Template7Utils.getCompileVar;
var getCompiledArguments = Template7Utils.getCompiledArguments;
var stringToBlocks = TwiqUtils.stringToBlocks;
var getCompileVar = TwiqUtils.getCompileVar;
var getCompiledArguments = TwiqUtils.getCompiledArguments;

@@ -563,7 +563,7 @@ var blocks = stringToBlocks(template);

}
if (dynamicHelper || block.helperName in Template7Helpers) {
if (dynamicHelper || block.helperName in TwiqHelpers) {
compiledArguments = getCompiledArguments(block.contextName, ctx, data);
resultString += "r += (Template7Helpers" + (dynamicHelper ? ("[" + (block.helperName) + "]") : ("." + (block.helperName))) + ").call(" + ctx + ", " + (compiledArguments && ((compiledArguments + ", "))) + "{hash:" + (JSON.stringify(block.hash)) + ", data: " + data + " || {}, fn: " + (getCompileFn(block, depth + 1)) + ", inverse: " + (getCompileInverse(block, depth + 1)) + ", root: root, parents: " + parents + "});";
resultString += "r += (TwiqHelpers" + (dynamicHelper ? ("[" + (block.helperName) + "]") : ("." + (block.helperName))) + ").call(" + ctx + ", " + (compiledArguments && ((compiledArguments + ", "))) + "{hash:" + (JSON.stringify(block.hash)) + ", data: " + data + " || {}, fn: " + (getCompileFn(block, depth + 1)) + ", inverse: " + (getCompileInverse(block, depth + 1)) + ", root: root, parents: " + parents + "});";
} else if (block.contextName.length > 0) {
throw new Error(("Template7: Missing helper: \"" + (block.helperName) + "\""));
throw new Error(("Twiq: Missing helper: \"" + (block.helperName) + "\""));
} else {

@@ -573,5 +573,5 @@ variable = getCompileVar(block.helperName, ctx, data);

resultString += "if (isArray(" + variable + ")) {";
resultString += "r += (Template7Helpers.each).call(" + ctx + ", " + variable + ", {hash:" + (JSON.stringify(block.hash)) + ", data: " + data + " || {}, fn: " + (getCompileFn(block, depth + 1)) + ", inverse: " + (getCompileInverse(block, depth + 1)) + ", root: root, parents: " + parents + "});";
resultString += "r += (TwiqHelpers.each).call(" + ctx + ", " + variable + ", {hash:" + (JSON.stringify(block.hash)) + ", data: " + data + " || {}, fn: " + (getCompileFn(block, depth + 1)) + ", inverse: " + (getCompileInverse(block, depth + 1)) + ", root: root, parents: " + parents + "});";
resultString += '}else {';
resultString += "r += (Template7Helpers.with).call(" + ctx + ", " + variable + ", {hash:" + (JSON.stringify(block.hash)) + ", data: " + data + " || {}, fn: " + (getCompileFn(block, depth + 1)) + ", inverse: " + (getCompileInverse(block, depth + 1)) + ", root: root, parents: " + parents + "});";
resultString += "r += (TwiqHelpers.with).call(" + ctx + ", " + variable + ", {hash:" + (JSON.stringify(block.hash)) + ", data: " + data + " || {}, fn: " + (getCompileFn(block, depth + 1)) + ", inverse: " + (getCompileInverse(block, depth + 1)) + ", root: root, parents: " + parents + "});";
resultString += '}}';

@@ -591,14 +591,14 @@ }

staticAccessors.options.get = function () {
return Template7Options;
return TwiqOptions;
};
staticAccessors.partials.get = function () {
return Template7Partials;
return TwiqPartials;
};
staticAccessors.helpers.get = function () {
return Template7Helpers;
return TwiqHelpers;
};
Object.defineProperties( Template7Class, staticAccessors );
Object.defineProperties( TwiqClass, staticAccessors );
function Template7() {
function Twiq() {
var args = [], len = arguments.length;

@@ -610,3 +610,3 @@ while ( len-- ) args[ len ] = arguments[ len ];

if (args.length === 2) {
var instance = new Template7Class(template);
var instance = new TwiqClass(template);
var rendered = instance.compile()(data);

@@ -616,33 +616,33 @@ instance = null;

}
return new Template7Class(template);
return new TwiqClass(template);
}
Template7.registerHelper = function registerHelper(name, fn) {
Template7Class.helpers[name] = fn;
Twiq.registerHelper = function registerHelper(name, fn) {
TwiqClass.helpers[name] = fn;
};
Template7.unregisterHelper = function unregisterHelper(name) {
Template7Class.helpers[name] = undefined;
delete Template7Class.helpers[name];
Twiq.unregisterHelper = function unregisterHelper(name) {
TwiqClass.helpers[name] = undefined;
delete TwiqClass.helpers[name];
};
Template7.registerPartial = function registerPartial(name, template) {
Template7Class.partials[name] = { template: template };
Twiq.registerPartial = function registerPartial(name, template) {
TwiqClass.partials[name] = { template: template };
};
Template7.unregisterPartial = function unregisterPartial(name) {
if (Template7Class.partials[name]) {
Template7Class.partials[name] = undefined;
delete Template7Class.partials[name];
Twiq.unregisterPartial = function unregisterPartial(name) {
if (TwiqClass.partials[name]) {
TwiqClass.partials[name] = undefined;
delete TwiqClass.partials[name];
}
};
Template7.compile = function compile(template, options) {
var instance = new Template7Class(template, options);
Twiq.compile = function compile(template, options) {
var instance = new TwiqClass(template, options);
return instance.compile();
};
Template7.options = Template7Class.options;
Template7.helpers = Template7Class.helpers;
Template7.partials = Template7Class.partials;
Twiq.options = TwiqClass.options;
Twiq.helpers = TwiqClass.helpers;
Twiq.partials = TwiqClass.partials;
return Template7;
return Twiq;
})));
//# sourceMappingURL=template7.js.map
//# sourceMappingURL=twiq.js.map
/**
* Template7 0.4.0
* Twiq 1.4.0
* Mobile-first HTML template engine
*
* http://www.sweet.io/template7/
* http://www.sweet.io/twiq/
*

@@ -15,3 +15,3 @@ * Copyright 2018, John Doe

*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Template7=t()}(this,function(){"use strict";function Template7(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i=e[0],r=e[1];if(2===e.length){var n=new Template7Class(i),l=n.compile()(r);return n=null,l}return new Template7Class(i)}var t7ctx;t7ctx="undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0;var Template7Context=t7ctx,Template7Utils={quoteSingleRexExp:new RegExp("'","g"),quoteDoubleRexExp:new RegExp('"',"g"),isFunction:function(e){return"function"==typeof e},escape:function(e){return void 0!==Template7Context&&Template7Context.escape?Template7Context.escape(e):e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")},helperToSlices:function(e){var t,i,r,n=Template7Utils.quoteDoubleRexExp,l=Template7Utils.quoteSingleRexExp,a=e.replace(/[{}#}]/g,"").trim().split(" "),s=[];for(i=0;i<a.length;i+=1){var o=a[i],p=void 0,c=void 0;if(0===i)s.push(o);else if(0===o.indexOf('"')||0===o.indexOf("'"))if(p=0===o.indexOf('"')?n:l,c=0===o.indexOf('"')?'"':"'",2===o.match(p).length)s.push(o);else{for(t=0,r=i+1;r<a.length;r+=1)if(o+=" "+a[r],a[r].indexOf(c)>=0){t=r,s.push(o);break}t&&(i=t)}else if(o.indexOf("=")>0){var u=o.split("="),f=u[0],m=u[1];if(p||(p=0===m.indexOf('"')?n:l,c=0===m.indexOf('"')?'"':"'"),2!==m.match(p).length){for(t=0,r=i+1;r<a.length;r+=1)if(m+=" "+a[r],a[r].indexOf(c)>=0){t=r;break}t&&(i=t)}var d=[f,m.replace(p,"")];s.push(d)}else s.push(o)}return s},stringToBlocks:function(e){var t,i,r=[];if(!e)return[];var n=e.split(/({{[^{^}]*}})/);for(t=0;t<n.length;t+=1){var l=n[t];if(""!==l)if(l.indexOf("{{")<0)r.push({type:"plain",content:l});else{if(l.indexOf("{/")>=0)continue;if((l=l.replace(/{{([#/])*([ ])*/,"{{$1").replace(/([ ])*}}/,"}}")).indexOf("{#")<0&&l.indexOf(" ")<0&&l.indexOf("else")<0){r.push({type:"variable",contextName:l.replace(/[{}]/g,"")});continue}var a=Template7Utils.helperToSlices(l),s=a[0],o=">"===s,p=[],c={};for(i=1;i<a.length;i+=1){var u=a[i];Array.isArray(u)?c[u[0]]="false"!==u[1]&&u[1]:p.push(u)}if(l.indexOf("{#")>=0){var f="",m="",d=0,g=void 0,h=!1,x=!1,v=0;for(i=t+1;i<n.length;i+=1)if(n[i].indexOf("{{#")>=0&&(v+=1),n[i].indexOf("{{/")>=0&&(v-=1),n[i].indexOf("{{#"+s)>=0)f+=n[i],x&&(m+=n[i]),d+=1;else if(n[i].indexOf("{{/"+s)>=0){if(!(d>0)){g=i,h=!0;break}d-=1,f+=n[i],x&&(m+=n[i])}else n[i].indexOf("else")>=0&&0===v?x=!0:(x||(f+=n[i]),x&&(m+=n[i]));h&&(g&&(t=g),"raw"===s?r.push({type:"plain",content:f}):r.push({type:"helper",helperName:s,contextName:p,content:f,inverseContent:m,hash:c}))}else l.indexOf(" ")>0&&(o&&(s="_partial",p[0]&&(0===p[0].indexOf("[")?p[0]=p[0].replace(/[[\]]/g,""):p[0]='"'+p[0].replace(/"|'/g,"")+'"')),r.push({type:"helper",helperName:s,contextName:p,hash:c}))}}return r},parseJsVariable:function(e,t,i){return e.split(/([+ \-*/^])/g).map(function(e){if(e.indexOf(t)<0)return e;if(!i)return JSON.stringify("");var r=i;return e.indexOf(t+".")>=0&&e.split(t+".")[1].split(".").forEach(function(e){r=e in r?r[e]:void 0}),"string"==typeof r&&(r=JSON.stringify(r)),void 0===r&&(r="undefined"),r}).join("")},parseJsParents:function(e,t){return e.split(/([+ \-*^])/g).map(function(e){if(e.indexOf("../")<0)return e;if(!t||0===t.length)return JSON.stringify("");var i=e.split("../").length-1,r=i>t.length?t[t.length-1]:t[i-1];return e.replace(/..\//g,"").split(".").forEach(function(e){r=r[e]?r[e]:"undefined"}),JSON.stringify(r)}).join("")},getCompileVar:function(e,t,i){void 0===i&&(i="data_1");var r,n,l=t,a=0;0===e.indexOf("../")?(a=e.split("../").length-1,l="ctx_"+((n=l.split("_")[1]-a)>=1?n:1),r=e.split("../")[a].split(".")):0===e.indexOf("@global")?(l="Template7.global",r=e.split("@global.")[1].split(".")):0===e.indexOf("@root")?(l="root",r=e.split("@root.")[1].split(".")):r=e.split(".");for(var s=0;s<r.length;s+=1){var o=r[s];if(0===o.indexOf("@")){var p=i.split("_")[1];a>0&&(p=n),s>0?l+="[(data_"+p+" && data_"+p+"."+o.replace("@","")+")]":l="(data_"+p+" && data_"+p+"."+o.replace("@","")+")"}else(Number.isFinite?Number.isFinite(o):Template7Context.isFinite(o))?l+="["+o+"]":"this"===o||o.indexOf("this.")>=0||o.indexOf("this[")>=0||o.indexOf("this(")>=0?l=o.replace("this",t):l+="."+o}return l},getCompiledArguments:function(e,t,i){for(var r=[],n=0;n<e.length;n+=1)/^['"]/.test(e[n])?r.push(e[n]):/^(true|false|\d+)$/.test(e[n])?r.push(e[n]):r.push(Template7Utils.getCompileVar(e[n],t,i));return r.join(", ")}},Template7Helpers={_partial:function(e,t){var i=this,r=Template7Class.partials[e];return!r||r&&!r.template?"":(r.compiled||(r.compiled=new Template7Class(r.template).compile()),Object.keys(t.hash).forEach(function(e){i[e]=t.hash[e]}),r.compiled(i,t.data,t.root))},escape:function(e){if("string"!=typeof e)throw new Error('Template7: Passed context to "escape" helper should be a string');return Template7Utils.escape(e)},if:function(e,t){var i=e;return Template7Utils.isFunction(i)&&(i=i.call(this)),i?t.fn(this,t.data):t.inverse(this,t.data)},unless:function(e,t){var i=e;return Template7Utils.isFunction(i)&&(i=i.call(this)),i?t.inverse(this,t.data):t.fn(this,t.data)},each:function(e,t){var i=e,r="",n=0;if(Template7Utils.isFunction(i)&&(i=i.call(this)),Array.isArray(i)){for(t.hash.reverse&&(i=i.reverse()),n=0;n<i.length;n+=1)r+=t.fn(i[n],{first:0===n,last:n===i.length-1,index:n});t.hash.reverse&&(i=i.reverse())}else for(var l in i)n+=1,r+=t.fn(i[l],{key:l});return n>0?r:t.inverse(this)},with:function(e,t){var i=e;return Template7Utils.isFunction(i)&&(i=e.call(this)),t.fn(i)},join:function(e,t){var i=e;return Template7Utils.isFunction(i)&&(i=i.call(this)),i.join(t.hash.delimiter||t.hash.delimeter)},js:function js(expression,options){var data=options.data,func,execute=expression;return"index first last key".split(" ").forEach(function(e){if(void 0!==data[e]){var t=new RegExp("this.@"+e,"g"),i=new RegExp("@"+e,"g");execute=execute.replace(t,JSON.stringify(data[e])).replace(i,JSON.stringify(data[e]))}}),options.root&&execute.indexOf("@root")>=0&&(execute=Template7Utils.parseJsVariable(execute,"@root",options.root)),execute.indexOf("@global")>=0&&(execute=Template7Utils.parseJsVariable(execute,"@global",Template7Context.Template7.global)),execute.indexOf("../")>=0&&(execute=Template7Utils.parseJsParents(execute,options.parents)),func=execute.indexOf("return")>=0?"(function(){"+execute+"})":"(function(){return ("+execute+")})",eval(func).call(this)},js_if:function js_if(expression,options){var data=options.data,func,execute=expression;"index first last key".split(" ").forEach(function(e){if(void 0!==data[e]){var t=new RegExp("this.@"+e,"g"),i=new RegExp("@"+e,"g");execute=execute.replace(t,JSON.stringify(data[e])).replace(i,JSON.stringify(data[e]))}}),options.root&&execute.indexOf("@root")>=0&&(execute=Template7Utils.parseJsVariable(execute,"@root",options.root)),execute.indexOf("@global")>=0&&(execute=Template7Utils.parseJsVariable(execute,"@global",Template7Context.Template7.global)),execute.indexOf("../")>=0&&(execute=Template7Utils.parseJsParents(execute,options.parents)),func=execute.indexOf("return")>=0?"(function(){"+execute+"})":"(function(){return ("+execute+")})";var condition=eval(func).call(this);return condition?options.fn(this,options.data):options.inverse(this,options.data)}};Template7Helpers.js_compare=Template7Helpers.js_if;var Template7Options={},Template7Partials={},Template7Class=function(e){this.template=e},staticAccessors={options:{configurable:!0},partials:{configurable:!0},helpers:{configurable:!0}};return Template7Class.prototype.compile=function compile(template,depth){function getCompileFn(e,i){return e.content?t.compile(e.content,i):function(){return""}}function getCompileInverse(e,i){return e.inverseContent?t.compile(e.inverseContent,i):function(){return""}}void 0===template&&(template=this.template),void 0===depth&&(depth=1);var t=this;if(t.compiled)return t.compiled;if("string"!=typeof template)throw new Error("Template7: Template must be a string");var stringToBlocks=Template7Utils.stringToBlocks,getCompileVar=Template7Utils.getCompileVar,getCompiledArguments=Template7Utils.getCompiledArguments,blocks=stringToBlocks(template),ctx="ctx_"+depth,data="data_"+depth;if(0===blocks.length)return function(){return""};var resultString="";resultString+=1===depth?"(function ("+ctx+", "+data+", root) {\n":"(function ("+ctx+", "+data+") {\n",1===depth&&(resultString+="function isArray(arr){return Array.isArray(arr);}\n",resultString+="function isFunction(func){return (typeof func === 'function');}\n",resultString+='function c(val, ctx) {if (typeof val !== "undefined" && val !== null) {if (isFunction(val)) {return val.call(ctx);} else return val;} else return "";}\n',resultString+="root = root || ctx_1 || {};\n"),resultString+="var r = '';\n";var i;for(i=0;i<blocks.length;i+=1){var block=blocks[i];if("plain"!==block.type){var variable=void 0,compiledArguments=void 0;if("variable"===block.type&&(variable=getCompileVar(block.contextName,ctx,data),resultString+="r += c("+variable+", "+ctx+");"),"helper"===block.type){var parents=void 0;if("ctx_1"!==ctx){for(var level=ctx.split("_")[1],parentsString="ctx_"+(level-1),j=level-2;j>=1;j-=1)parentsString+=", ctx_"+j;parents="["+parentsString+"]"}else parents="["+ctx+"]";var dynamicHelper=void 0;if(0===block.helperName.indexOf("[")&&(block.helperName=getCompileVar(block.helperName.replace(/[[\]]/g,""),ctx,data),dynamicHelper=!0),dynamicHelper||block.helperName in Template7Helpers)compiledArguments=getCompiledArguments(block.contextName,ctx,data),resultString+="r += (Template7Helpers"+(dynamicHelper?"["+block.helperName+"]":"."+block.helperName)+").call("+ctx+", "+(compiledArguments&&compiledArguments+", ")+"{hash:"+JSON.stringify(block.hash)+", data: "+data+" || {}, fn: "+getCompileFn(block,depth+1)+", inverse: "+getCompileInverse(block,depth+1)+", root: root, parents: "+parents+"});";else{if(block.contextName.length>0)throw new Error('Template7: Missing helper: "'+block.helperName+'"');variable=getCompileVar(block.helperName,ctx,data),resultString+="if ("+variable+") {",resultString+="if (isArray("+variable+")) {",resultString+="r += (Template7Helpers.each).call("+ctx+", "+variable+", {hash:"+JSON.stringify(block.hash)+", data: "+data+" || {}, fn: "+getCompileFn(block,depth+1)+", inverse: "+getCompileInverse(block,depth+1)+", root: root, parents: "+parents+"});",resultString+="}else {",resultString+="r += (Template7Helpers.with).call("+ctx+", "+variable+", {hash:"+JSON.stringify(block.hash)+", data: "+data+" || {}, fn: "+getCompileFn(block,depth+1)+", inverse: "+getCompileInverse(block,depth+1)+", root: root, parents: "+parents+"});",resultString+="}}"}}}else resultString+="r +='"+block.content.replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/'/g,"\\'")+"';"}return resultString+="\nreturn r;})",1===depth?(t.compiled=eval(resultString),t.compiled):resultString},staticAccessors.options.get=function(){return Template7Options},staticAccessors.partials.get=function(){return Template7Partials},staticAccessors.helpers.get=function(){return Template7Helpers},Object.defineProperties(Template7Class,staticAccessors),Template7.registerHelper=function(e,t){Template7Class.helpers[e]=t},Template7.unregisterHelper=function(e){Template7Class.helpers[e]=void 0,delete Template7Class.helpers[e]},Template7.registerPartial=function(e,t){Template7Class.partials[e]={template:t}},Template7.unregisterPartial=function(e){Template7Class.partials[e]&&(Template7Class.partials[e]=void 0,delete Template7Class.partials[e])},Template7.compile=function(e,t){return new Template7Class(e,t).compile()},Template7.options=Template7Class.options,Template7.helpers=Template7Class.helpers,Template7.partials=Template7Class.partials,Template7});
//# sourceMappingURL=template7.min.js.map
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Twiq=t()}(this,function(){"use strict";function Twiq(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i=e[0],r=e[1];if(2===e.length){var n=new TwiqClass(i),l=n.compile()(r);return n=null,l}return new TwiqClass(i)}var t7ctx;t7ctx="undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0;var TwiqContext=t7ctx,TwiqUtils={quoteSingleRexExp:new RegExp("'","g"),quoteDoubleRexExp:new RegExp('"',"g"),isFunction:function(e){return"function"==typeof e},escape:function(e){return void 0!==TwiqContext&&TwiqContext.escape?TwiqContext.escape(e):e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")},helperToSlices:function(e){var t,i,r,n=TwiqUtils.quoteDoubleRexExp,l=TwiqUtils.quoteSingleRexExp,a=e.replace(/[{}#}]/g,"").trim().split(" "),s=[];for(i=0;i<a.length;i+=1){var o=a[i],p=void 0,c=void 0;if(0===i)s.push(o);else if(0===o.indexOf('"')||0===o.indexOf("'"))if(p=0===o.indexOf('"')?n:l,c=0===o.indexOf('"')?'"':"'",2===o.match(p).length)s.push(o);else{for(t=0,r=i+1;r<a.length;r+=1)if(o+=" "+a[r],a[r].indexOf(c)>=0){t=r,s.push(o);break}t&&(i=t)}else if(o.indexOf("=")>0){var u=o.split("="),f=u[0],m=u[1];if(p||(p=0===m.indexOf('"')?n:l,c=0===m.indexOf('"')?'"':"'"),2!==m.match(p).length){for(t=0,r=i+1;r<a.length;r+=1)if(m+=" "+a[r],a[r].indexOf(c)>=0){t=r;break}t&&(i=t)}var d=[f,m.replace(p,"")];s.push(d)}else s.push(o)}return s},stringToBlocks:function(e){var t,i,r=[];if(!e)return[];var n=e.split(/({{[^{^}]*}})/);for(t=0;t<n.length;t+=1){var l=n[t];if(""!==l)if(l.indexOf("{{")<0)r.push({type:"plain",content:l});else{if(l.indexOf("{/")>=0)continue;if((l=l.replace(/{{([#/])*([ ])*/,"{{$1").replace(/([ ])*}}/,"}}")).indexOf("{#")<0&&l.indexOf(" ")<0&&l.indexOf("else")<0){r.push({type:"variable",contextName:l.replace(/[{}]/g,"")});continue}var a=TwiqUtils.helperToSlices(l),s=a[0],o=">"===s,p=[],c={};for(i=1;i<a.length;i+=1){var u=a[i];Array.isArray(u)?c[u[0]]="false"!==u[1]&&u[1]:p.push(u)}if(l.indexOf("{#")>=0){var f="",m="",d=0,g=void 0,h=!1,x=!1,v=0;for(i=t+1;i<n.length;i+=1)if(n[i].indexOf("{{#")>=0&&(v+=1),n[i].indexOf("{{/")>=0&&(v-=1),n[i].indexOf("{{#"+s)>=0)f+=n[i],x&&(m+=n[i]),d+=1;else if(n[i].indexOf("{{/"+s)>=0){if(!(d>0)){g=i,h=!0;break}d-=1,f+=n[i],x&&(m+=n[i])}else n[i].indexOf("else")>=0&&0===v?x=!0:(x||(f+=n[i]),x&&(m+=n[i]));h&&(g&&(t=g),"raw"===s?r.push({type:"plain",content:f}):r.push({type:"helper",helperName:s,contextName:p,content:f,inverseContent:m,hash:c}))}else l.indexOf(" ")>0&&(o&&(s="_partial",p[0]&&(0===p[0].indexOf("[")?p[0]=p[0].replace(/[[\]]/g,""):p[0]='"'+p[0].replace(/"|'/g,"")+'"')),r.push({type:"helper",helperName:s,contextName:p,hash:c}))}}return r},parseJsVariable:function(e,t,i){return e.split(/([+ \-*/^])/g).map(function(e){if(e.indexOf(t)<0)return e;if(!i)return JSON.stringify("");var r=i;return e.indexOf(t+".")>=0&&e.split(t+".")[1].split(".").forEach(function(e){r=e in r?r[e]:void 0}),"string"==typeof r&&(r=JSON.stringify(r)),void 0===r&&(r="undefined"),r}).join("")},parseJsParents:function(e,t){return e.split(/([+ \-*^])/g).map(function(e){if(e.indexOf("../")<0)return e;if(!t||0===t.length)return JSON.stringify("");var i=e.split("../").length-1,r=i>t.length?t[t.length-1]:t[i-1];return e.replace(/..\//g,"").split(".").forEach(function(e){r=r[e]?r[e]:"undefined"}),JSON.stringify(r)}).join("")},getCompileVar:function(e,t,i){void 0===i&&(i="data_1");var r,n,l=t,a=0;0===e.indexOf("../")?(a=e.split("../").length-1,l="ctx_"+((n=l.split("_")[1]-a)>=1?n:1),r=e.split("../")[a].split(".")):0===e.indexOf("@global")?(l="Twiq.global",r=e.split("@global.")[1].split(".")):0===e.indexOf("@root")?(l="root",r=e.split("@root.")[1].split(".")):r=e.split(".");for(var s=0;s<r.length;s+=1){var o=r[s];if(0===o.indexOf("@")){var p=i.split("_")[1];a>0&&(p=n),s>0?l+="[(data_"+p+" && data_"+p+"."+o.replace("@","")+")]":l="(data_"+p+" && data_"+p+"."+o.replace("@","")+")"}else(Number.isFinite?Number.isFinite(o):TwiqContext.isFinite(o))?l+="["+o+"]":"this"===o||o.indexOf("this.")>=0||o.indexOf("this[")>=0||o.indexOf("this(")>=0?l=o.replace("this",t):l+="."+o}return l},getCompiledArguments:function(e,t,i){for(var r=[],n=0;n<e.length;n+=1)/^['"]/.test(e[n])?r.push(e[n]):/^(true|false|\d+)$/.test(e[n])?r.push(e[n]):r.push(TwiqUtils.getCompileVar(e[n],t,i));return r.join(", ")}},TwiqHelpers={_partial:function(e,t){var i=this,r=TwiqClass.partials[e];return!r||r&&!r.template?"":(r.compiled||(r.compiled=new TwiqClass(r.template).compile()),Object.keys(t.hash).forEach(function(e){i[e]=t.hash[e]}),r.compiled(i,t.data,t.root))},escape:function(e){if("string"!=typeof e)throw new Error('Twiq: Passed context to "escape" helper should be a string');return TwiqUtils.escape(e)},if:function(e,t){var i=e;return TwiqUtils.isFunction(i)&&(i=i.call(this)),i?t.fn(this,t.data):t.inverse(this,t.data)},unless:function(e,t){var i=e;return TwiqUtils.isFunction(i)&&(i=i.call(this)),i?t.inverse(this,t.data):t.fn(this,t.data)},each:function(e,t){var i=e,r="",n=0;if(TwiqUtils.isFunction(i)&&(i=i.call(this)),Array.isArray(i)){for(t.hash.reverse&&(i=i.reverse()),n=0;n<i.length;n+=1)r+=t.fn(i[n],{first:0===n,last:n===i.length-1,index:n});t.hash.reverse&&(i=i.reverse())}else for(var l in i)n+=1,r+=t.fn(i[l],{key:l});return n>0?r:t.inverse(this)},with:function(e,t){var i=e;return TwiqUtils.isFunction(i)&&(i=e.call(this)),t.fn(i)},join:function(e,t){var i=e;return TwiqUtils.isFunction(i)&&(i=i.call(this)),i.join(t.hash.delimiter||t.hash.delimeter)},js:function js(expression,options){var data=options.data,func,execute=expression;return"index first last key".split(" ").forEach(function(e){if(void 0!==data[e]){var t=new RegExp("this.@"+e,"g"),i=new RegExp("@"+e,"g");execute=execute.replace(t,JSON.stringify(data[e])).replace(i,JSON.stringify(data[e]))}}),options.root&&execute.indexOf("@root")>=0&&(execute=TwiqUtils.parseJsVariable(execute,"@root",options.root)),execute.indexOf("@global")>=0&&(execute=TwiqUtils.parseJsVariable(execute,"@global",TwiqContext.Twiq.global)),execute.indexOf("../")>=0&&(execute=TwiqUtils.parseJsParents(execute,options.parents)),func=execute.indexOf("return")>=0?"(function(){"+execute+"})":"(function(){return ("+execute+")})",eval(func).call(this)},js_if:function js_if(expression,options){var data=options.data,func,execute=expression;"index first last key".split(" ").forEach(function(e){if(void 0!==data[e]){var t=new RegExp("this.@"+e,"g"),i=new RegExp("@"+e,"g");execute=execute.replace(t,JSON.stringify(data[e])).replace(i,JSON.stringify(data[e]))}}),options.root&&execute.indexOf("@root")>=0&&(execute=TwiqUtils.parseJsVariable(execute,"@root",options.root)),execute.indexOf("@global")>=0&&(execute=TwiqUtils.parseJsVariable(execute,"@global",TwiqContext.Twiq.global)),execute.indexOf("../")>=0&&(execute=TwiqUtils.parseJsParents(execute,options.parents)),func=execute.indexOf("return")>=0?"(function(){"+execute+"})":"(function(){return ("+execute+")})";var condition=eval(func).call(this);return condition?options.fn(this,options.data):options.inverse(this,options.data)}};TwiqHelpers.js_compare=TwiqHelpers.js_if;var TwiqOptions={},TwiqPartials={},TwiqClass=function(e){this.template=e},staticAccessors={options:{configurable:!0},partials:{configurable:!0},helpers:{configurable:!0}};return TwiqClass.prototype.compile=function compile(template,depth){function getCompileFn(e,i){return e.content?t.compile(e.content,i):function(){return""}}function getCompileInverse(e,i){return e.inverseContent?t.compile(e.inverseContent,i):function(){return""}}void 0===template&&(template=this.template),void 0===depth&&(depth=1);var t=this;if(t.compiled)return t.compiled;if("string"!=typeof template)throw new Error("Twiq: Template must be a string");var stringToBlocks=TwiqUtils.stringToBlocks,getCompileVar=TwiqUtils.getCompileVar,getCompiledArguments=TwiqUtils.getCompiledArguments,blocks=stringToBlocks(template),ctx="ctx_"+depth,data="data_"+depth;if(0===blocks.length)return function(){return""};var resultString="";resultString+=1===depth?"(function ("+ctx+", "+data+", root) {\n":"(function ("+ctx+", "+data+") {\n",1===depth&&(resultString+="function isArray(arr){return Array.isArray(arr);}\n",resultString+="function isFunction(func){return (typeof func === 'function');}\n",resultString+='function c(val, ctx) {if (typeof val !== "undefined" && val !== null) {if (isFunction(val)) {return val.call(ctx);} else return val;} else return "";}\n',resultString+="root = root || ctx_1 || {};\n"),resultString+="var r = '';\n";var i;for(i=0;i<blocks.length;i+=1){var block=blocks[i];if("plain"!==block.type){var variable=void 0,compiledArguments=void 0;if("variable"===block.type&&(variable=getCompileVar(block.contextName,ctx,data),resultString+="r += c("+variable+", "+ctx+");"),"helper"===block.type){var parents=void 0;if("ctx_1"!==ctx){for(var level=ctx.split("_")[1],parentsString="ctx_"+(level-1),j=level-2;j>=1;j-=1)parentsString+=", ctx_"+j;parents="["+parentsString+"]"}else parents="["+ctx+"]";var dynamicHelper=void 0;if(0===block.helperName.indexOf("[")&&(block.helperName=getCompileVar(block.helperName.replace(/[[\]]/g,""),ctx,data),dynamicHelper=!0),dynamicHelper||block.helperName in TwiqHelpers)compiledArguments=getCompiledArguments(block.contextName,ctx,data),resultString+="r += (TwiqHelpers"+(dynamicHelper?"["+block.helperName+"]":"."+block.helperName)+").call("+ctx+", "+(compiledArguments&&compiledArguments+", ")+"{hash:"+JSON.stringify(block.hash)+", data: "+data+" || {}, fn: "+getCompileFn(block,depth+1)+", inverse: "+getCompileInverse(block,depth+1)+", root: root, parents: "+parents+"});";else{if(block.contextName.length>0)throw new Error('Twiq: Missing helper: "'+block.helperName+'"');variable=getCompileVar(block.helperName,ctx,data),resultString+="if ("+variable+") {",resultString+="if (isArray("+variable+")) {",resultString+="r += (TwiqHelpers.each).call("+ctx+", "+variable+", {hash:"+JSON.stringify(block.hash)+", data: "+data+" || {}, fn: "+getCompileFn(block,depth+1)+", inverse: "+getCompileInverse(block,depth+1)+", root: root, parents: "+parents+"});",resultString+="}else {",resultString+="r += (TwiqHelpers.with).call("+ctx+", "+variable+", {hash:"+JSON.stringify(block.hash)+", data: "+data+" || {}, fn: "+getCompileFn(block,depth+1)+", inverse: "+getCompileInverse(block,depth+1)+", root: root, parents: "+parents+"});",resultString+="}}"}}}else resultString+="r +='"+block.content.replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/'/g,"\\'")+"';"}return resultString+="\nreturn r;})",1===depth?(t.compiled=eval(resultString),t.compiled):resultString},staticAccessors.options.get=function(){return TwiqOptions},staticAccessors.partials.get=function(){return TwiqPartials},staticAccessors.helpers.get=function(){return TwiqHelpers},Object.defineProperties(TwiqClass,staticAccessors),Twiq.registerHelper=function(e,t){TwiqClass.helpers[e]=t},Twiq.unregisterHelper=function(e){TwiqClass.helpers[e]=void 0,delete TwiqClass.helpers[e]},Twiq.registerPartial=function(e,t){TwiqClass.partials[e]={template:t}},Twiq.unregisterPartial=function(e){TwiqClass.partials[e]&&(TwiqClass.partials[e]=void 0,delete TwiqClass.partials[e])},Twiq.compile=function(e,t){return new TwiqClass(e,t).compile()},Twiq.options=TwiqClass.options,Twiq.helpers=TwiqClass.helpers,Twiq.partials=TwiqClass.partials,Twiq});
//# sourceMappingURL=twiq.min.js.map
{
"_args": [
[
"twiq@1.4.1",
"/Users/orz99/zoo/ikirin"
]
],
"_from": "twiq@1.4.1",
"_id": "twiq@1.4.1",
"_inBundle": false,
"_integrity": "sha512-NMJWbKIoowHixUYIHq+DLvcBM47t/oZ/xfvBbYuMusjjS6BUjC02+gLWctntJuTTiEqILfefBNCXbfp/EMt/zQ==",
"_location": "/twiq",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "twiq@1.4.1",
"name": "twiq",
"escapedName": "twiq",
"rawSpec": "1.4.1",
"saveSpec": null,
"fetchSpec": "1.4.1"
},
"_requiredBy": [
"/"
],
"_resolved": "https://registry.npmjs.org/twiq/-/twiq-1.4.1.tgz",
"_spec": "1.4.1",
"_where": "/Users/orz99/zoo/ikirin",
"author": {
"name": "John Doe"
},
"bugs": {
"url": "https://github.com/nolimits4web/twiq/issues"
},
"description": "Mobile-first HTML template engine",
"devDependencies": {
"eslint": "^4.9.0",
"eslint-config-airbnb": "^16.1.0",
"eslint-config-airbnb-base": "^12.1.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-react": "^7.4.0",
"gulp": "^3.9.1",
"gulp-connect": "^5.0.0",
"gulp-header": "^1.8.9",
"gulp-open": "^2.0.0",
"gulp-rename": "^1.2.2",
"gulp-sourcemaps": "^2.6.1",
"gulp-uglify": "^3.0.0",
"rollup-plugin-buble": "^0.19.2",
"rollup-stream": "^1.24.1",
"vinyl-buffer": "^1.0.1",
"vinyl-source-stream": "^2.0.0"
},
"engines": {
"node": ">= 0.10.0"
},
"homepage": "http://www.sweet.io/twiq/",
"jsnext:main": "dist/twiq.esm.js",
"keywords": [
"mobile",
"template",
"javascript",
"ios7",
"ios8",
"ios 8",
"iphone",
"ipad",
"phonegap",
"ikirin",
"handlebars",
"mustache"
],
"license": "MIT",
"main": "dist/twiq.js",
"module": "dist/twiq.esm.js",
"name": "twiq",
"version": "1.4.0",
"description": "",
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/nolimits4web/twiq.git"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"lint": "eslint .",
"test": "gulp build && npm run lint"
},
"author": "",
"license": "ISC"
"types": "dist/twiq.d.ts",
"version": "1.4.1"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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