{"_id":"bracket-templates","_rev":"38-a10e94d9f21ec6795d4dba80d0983b86","name":"bracket-templates","description":"Minimal javascript templating using square brackets.","dist-tags":{"latest":"0.1.0"},"versions":{"0.0.1":{"name":"bracket-templates","version":"0.0.1","description":"Dead simple text templates using square brackets - for JavaScript.","main":"index.js","scripts":{"test":"mocha"},"devDependencies":{"chai":"*","mocha":"*"},"repository":{"type":"git","url":"https://github.com/joelabair/Bracket-Templates.git"},"keywords":["template","square brackets","brackets","bracket","templates"],"author":{"name":"joel.a.bair@gmail.com"},"license":"GPLv2","bugs":{"url":"https://github.com/joelabair/Bracket-Templates/issues"},"_id":"bracket-templates@0.0.1","dist":{"shasum":"ba1caac07a4eb4f54c1185268be1b4efb04a6041","tarball":"https://registry.npmjs.org/bracket-templates/-/bracket-templates-0.0.1.tgz","integrity":"sha512-/kbNKA3uX/tvkXWREWslun0mlNu7+j7Tf6gs82FbeEnogGpoxTykkHokIo4r/Oy3rpWiPc1BSvYUsDEsHV0H7Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHKO6X2b4Foh3tR2XhtQuec4/XCiL5kdUBUGAd4kjEcXAiAshppAZS8+XmeN5gpN794Qk0vFqwTCfriPzTaU5eIogA=="}]},"_from":".","_npmVersion":"1.3.6","_npmUser":{"name":"joelbair","email":"joe.a.bair@gmail.com"},"maintainers":[{"name":"joelbair","email":"joe.a.bair@gmail.com"}]},"0.0.2":{"name":"bracket-templates","version":"0.0.2","description":"Dead simple text templates using square brackets - for JavaScript.","main":"index.js","scripts":{"test":"mocha"},"devDependencies":{"chai":"*","mocha":"*"},"repository":{"type":"git","url":"https://github.com/joelabair/Bracket-Templates.git"},"keywords":["template","square brackets","brackets","bracket","templates"],"author":{"name":"joel.a.bair@gmail.com"},"license":"GPLv2","bugs":{"url":"https://github.com/joelabair/Bracket-Templates/issues"},"_id":"bracket-templates@0.0.2","dist":{"shasum":"fff7fdde574463ad7458291d35a44f9a6836b8b3","tarball":"https://registry.npmjs.org/bracket-templates/-/bracket-templates-0.0.2.tgz","integrity":"sha512-XAFLyfcVKdhcvSVVnnwBojfh2+uMy7D6BdenIspnS9wir0CkAPg+I0Jy0Yn88/DPoAMLbL/4rpemwr2A+6etig==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAngiGIF1TbCFB2xeo/HCDHA+JZc2zoqGL+C98pi3c4vAiAs8tU77SYIKrm8obGV2wmdZ6QkwwmLvNCSyfEm7aH2UA=="}]},"_from":".","_npmVersion":"1.3.6","_npmUser":{"name":"joelbair","email":"joel.a.bair@gmail.com"},"maintainers":[{"name":"joelbair","email":"joe.a.bair@gmail.com"}]},"0.0.3":{"name":"bracket-templates","version":"0.0.3","description":"Minimal javascript templating using square brackets.","main":"index.js","scripts":{"test":"mocha"},"dependencies":{"regexp-quote":"~0.0.0"},"devDependencies":{"chai":"*","mocha":"*"},"repository":{"type":"git","url":"https://github.com/joelabair/Bracket-Templates.git"},"keywords":["template","square brackets","brackets","bracket","templates"],"author":{"name":"joel.a.bair@gmail.com"},"license":"GPLv2","bugs":{"url":"https://github.com/joelabair/Bracket-Templates/issues"},"_id":"bracket-templates@0.0.3","dist":{"shasum":"77ff53c03978af2a9510dc1c7aa69ac564e4350e","tarball":"https://registry.npmjs.org/bracket-templates/-/bracket-templates-0.0.3.tgz","integrity":"sha512-DkJTLXNOMygNl5tkxsgHmgVLbyBq0O9OR9OmdqQxs+cqDokFUHfYOtShop3uggAc2C+u7LIQjHGzvEmWyEaWMw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEWrXY24//wxKQa4ufTyCQzXxZp5oVJKpWVEG85HCgtDAiBCYuK0QFcgm7qBnbgRCJrGZ7eNoZT0wJ0P7Ko8NWX0mQ=="}]},"_from":".","_npmVersion":"1.3.6","_npmUser":{"name":"joelbair","email":"joel.a.bair@gmail.com"},"maintainers":[{"name":"joelbair","email":"joe.a.bair@gmail.com"}]},"0.0.5":{"name":"bracket-templates","version":"0.0.5","description":"Minimal javascript templating using square brackets.","main":"index.js","scripts":{"test":"mocha"},"dependencies":{"regexp-quote":"~0.0.0"},"devDependencies":{"chai":"*","mocha":"*"},"repository":{"type":"git","url":"https://github.com/joelabair/Bracket-Templates.git"},"keywords":["template","square brackets","brackets","bracket","templates"],"author":{"name":"joel.a.bair@gmail.com"},"license":"GPLv2","bugs":{"url":"https://github.com/joelabair/Bracket-Templates/issues"},"gitHead":"9e5edf62c8042d1fae6d82a3dd9fd6d1fe993948","homepage":"https://github.com/joelabair/Bracket-Templates","_id":"bracket-templates@0.0.5","_shasum":"8654f67d09fadd4dade440eaec5bc45f73f192dd","_from":".","_npmVersion":"1.4.20","_npmUser":{"name":"joelbair","email":"joel.a.bair@gmail.com"},"maintainers":[{"name":"joelbair","email":"joe.a.bair@gmail.com"}],"dist":{"shasum":"8654f67d09fadd4dade440eaec5bc45f73f192dd","tarball":"https://registry.npmjs.org/bracket-templates/-/bracket-templates-0.0.5.tgz","integrity":"sha512-IyEqpO8m8uk8TATkRj+jf/rcv/yFI2B9H3DOSSCejVObe0UGNOPSpBo8kt8XnJt1CW351rOdtqTvc3sS7vNE9g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIE+VDHNQR8LOTOo3YlFaovsw5dtafw1Ynb/zjqh6irvnAiAhqfnaSC23l6iMzLwdYLZuD4Bjw01aTj3bBJS1w9QGww=="}]}},"0.0.6":{"name":"bracket-templates","version":"0.0.6","description":"Minimal javascript templating using square brackets.","main":"index.js","scripts":{"test":"mocha"},"dependencies":{"regexp-quote":"~0.0.0"},"devDependencies":{"chai":"*","mocha":"*"},"repository":{"type":"git","url":"https://github.com/joelabair/Bracket-Templates.git"},"keywords":["template","square brackets","brackets","bracket","templates"],"author":{"name":"joel.a.bair@gmail.com"},"license":"GPLv2","bugs":{"url":"https://github.com/joelabair/Bracket-Templates/issues"},"gitHead":"42a13262fbf79674c555a24137e2564890d240ed","homepage":"https://github.com/joelabair/Bracket-Templates","_id":"bracket-templates@0.0.6","_shasum":"8df411b22d0d2ba9e777abf4b1f1fbb038b417b9","_from":".","_npmVersion":"1.4.20","_npmUser":{"name":"joelbair","email":"joel.a.bair@gmail.com"},"maintainers":[{"name":"joelbair","email":"joe.a.bair@gmail.com"}],"dist":{"shasum":"8df411b22d0d2ba9e777abf4b1f1fbb038b417b9","tarball":"https://registry.npmjs.org/bracket-templates/-/bracket-templates-0.0.6.tgz","integrity":"sha512-t1iD6kiQCxTDEz0vNZTUw/PFVLUkmi7L1J894kq2BZOmMxHNyx4z/6iVQHUntkx0m7EH7WKY9zNoF82ZlsRFBw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCgYf+0lGpXnZBzvEsb+Hn2k+mWe8JvWHwBQvfuQ1darAIhAO/0wHszJahPXmkY1X0730HpRNXkaaNQCnuJWVozLKPJ"}]}},"0.0.7":{"name":"bracket-templates","version":"0.0.7","description":"Minimal javascript templating using square brackets.","main":"index.js","scripts":{"test":"mocha"},"dependencies":{"regexp-quote":"~0.0.0"},"devDependencies":{"chai":"*","mocha":"*"},"repository":{"type":"git","url":"https://github.com/joelabair/Bracket-Templates.git"},"keywords":["template","square brackets","brackets","bracket","templates"],"author":{"name":"joel.a.bair@gmail.com"},"license":"GPLv2","bugs":{"url":"https://github.com/joelabair/Bracket-Templates/issues"},"gitHead":"3d6783d02f8835ca9ed48459001a22ce5b96ef97","homepage":"https://github.com/joelabair/Bracket-Templates","_id":"bracket-templates@0.0.7","_shasum":"048591e32f87bb775d86de31875dbf548079c3b3","_from":".","_npmVersion":"1.4.20","_npmUser":{"name":"joelbair","email":"joel.a.bair@gmail.com"},"maintainers":[{"name":"joelbair","email":"joe.a.bair@gmail.com"}],"dist":{"shasum":"048591e32f87bb775d86de31875dbf548079c3b3","tarball":"https://registry.npmjs.org/bracket-templates/-/bracket-templates-0.0.7.tgz","integrity":"sha512-UlHH4KIw6x7myDy/NOuMd14byFbTKxBAUwEPoBDkP10flMPwqGff/eUF7azpCkQ/7uw6IxD7zKXP8Blb/SrY0g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDhOk3P+wfq0qWWLS/LdFgyNwsXOINfsz4RUYxbmO4VmQIgXuosoqM2bMOgMXQDV13l3VqM/DJZ/c51PpDDn7CRVgs="}]}},"0.0.8":{"name":"bracket-templates","version":"0.0.8","description":"Minimal javascript templating using square brackets.","main":"index.js","scripts":{"test":"mocha"},"dependencies":{"regexp-quote":"~0.0.0"},"devDependencies":{"chai":"*","mocha":"*"},"repository":{"type":"git","url":"https://github.com/joelabair/Bracket-Templates.git"},"keywords":["template","square brackets","brackets","bracket","templates"],"author":{"name":"joel.a.bair@gmail.com"},"license":"GPLv2","bugs":{"url":"https://github.com/joelabair/Bracket-Templates/issues"},"gitHead":"0f93fa988c34d0a6468d3228b7952ef01fb798ed","homepage":"https://github.com/joelabair/Bracket-Templates","_id":"bracket-templates@0.0.8","_shasum":"920f9a2189e186d689b104cdfeebab2dbeafcfe6","_from":".","_npmVersion":"1.4.20","_npmUser":{"name":"joelbair","email":"joel.a.bair@gmail.com"},"maintainers":[{"name":"joelbair","email":"joe.a.bair@gmail.com"}],"dist":{"shasum":"920f9a2189e186d689b104cdfeebab2dbeafcfe6","tarball":"https://registry.npmjs.org/bracket-templates/-/bracket-templates-0.0.8.tgz","integrity":"sha512-eI/Rvc4PKLkKURNhC8AQIguGBjR/+/asylq28qR1nCJkqR8mqEyPQNfpHmeSuEfu+a71y4Kx8Psaj6RrdA2pwA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF8SUTv5cAzih98WCQrm1EwCutkXDRPYUE3KMfKCdMQSAiApf3GajSubkbTNNwE9rf/9DGEFh4bRC9bdfLS1ow2FaQ=="}]}},"0.0.9":{"name":"bracket-templates","version":"0.0.9","description":"Minimal javascript templating using square brackets.","main":"index.js","scripts":{"test":"mocha"},"dependencies":{"regexp-quote":"~0.0.0"},"devDependencies":{"chai":"*","mocha":"*"},"repository":{"type":"git","url":"https://github.com/joelabair/Bracket-Templates.git"},"keywords":["template","square brackets","brackets","bracket","templates"],"author":{"name":"joel.a.bair@gmail.com"},"license":"GPLv2","bugs":{"url":"https://github.com/joelabair/Bracket-Templates/issues"},"_id":"bracket-templates@0.0.9","dist":{"shasum":"1f7c90c31bc62e8aa400da08c4daf43881f5a670","tarball":"https://registry.npmjs.org/bracket-templates/-/bracket-templates-0.0.9.tgz","integrity":"sha512-YRXQe6XrmvYNDzAzEXR7FT8nQjDGTVJdpNPLvB/PdRSP+mnMuOnUO3rllVshw9KfuqqkyYjfk4EMmaZv0QvYyw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG7l5myhLrCciSlKky/dmkEfxkeVyb002uOQSwKt2WBVAiBca6x5KjBDsLyuuw8mn3CxSXgNbOAR3y0c8moK9cNKvQ=="}]},"_from":".","_npmVersion":"1.3.6","_npmUser":{"name":"joelbair","email":"joel.a.bair@gmail.com"},"maintainers":[{"name":"joelbair","email":"joe.a.bair@gmail.com"}]},"0.1.0":{"name":"bracket-templates","version":"0.1.0","description":"Minimal javascript templating using square brackets.","main":"index.js","scripts":{"test":"mocha"},"dependencies":{"regexp-quote":"~0.0.0"},"devDependencies":{"chai":"*","mocha":"*"},"repository":{"type":"git","url":"git+https://github.com/joelabair/Bracket-Templates.git"},"keywords":["template","square brackets","brackets","bracket","templates"],"author":{"name":"joel.a.bair@gmail.com"},"license":"GPLv2","bugs":{"url":"https://github.com/joelabair/Bracket-Templates/issues"},"gitHead":"6a2025b900e1dde68bf20820c3dec7c48bf98c7d","homepage":"https://github.com/joelabair/Bracket-Templates#readme","_id":"bracket-templates@0.1.0","_shasum":"a77d31b957f9e4b6488a4adc928f9637a64b2a1f","_from":".","_npmVersion":"2.15.11","_nodeVersion":"4.8.4","_npmUser":{"name":"joelbair","email":"joel.a.bair@gmail.com"},"dist":{"shasum":"a77d31b957f9e4b6488a4adc928f9637a64b2a1f","tarball":"https://registry.npmjs.org/bracket-templates/-/bracket-templates-0.1.0.tgz","integrity":"sha512-3oJPC2uTYWqjrIAFOG+t4WAq5b0IXRSmihJ2g2NmOegq7E9q+CZyAC91fA/gyn4dBIoyStc+T3xUApo7Zc8RHQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBnkqX+7fUz2nJb/VgQUafFb1qkYu04nofVtX+2B1WyXAiARBod/l5/OYdPmm4hSxxsSQ3JBw8eoeHRhxxuvVXbFrA=="}]},"maintainers":[{"name":"joelbair","email":"joe.a.bair@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/bracket-templates-0.1.0.tgz_1511912331086_0.7383481457363814"}}},"readme":"Bracket-Templates\n=================\n\nA mimimal JavaScript template engine inspired by [mustache](http://mustache.github.io/mustache.5.html) using square brackets, supporting default strings, sub-key notation, block iterators and truthy conditional logic.\n\n###Instlation\n```\n$ npm install bracket-templates\n```\n\n###Options:\n```js\nvar bracket = require('bracket-templates');\nbracket.options = {\n  prefix: '',   \t\t\t// (default = none), an optional placeholder prefix string.\n  debug: false  \t// (default = false), enable debug messages on the console.\n  strictKeys: false\t// (default = false), when true, only mutate found keys - partial rendering.\n};\n```\n\n###Render Method:\n```js\nbracket.render(template, dataObj[, options, callback])\n```\n * template - Can be either a String or a Buffer (string-in, string-out & buffer-in, buffer-out).\n * dataObj  - Any javascript Object or Array.\n * options  - Local options obejct.\n * callback - A callback function.\n\n###Template Tag Syntax: [ {propertyName} [: {defaultValue}] ]\nTemplate placeholders are enclosed by square brackets (obviously), and represent data object property names and/or any nested key identifiers (via dot, hyphen, or undersocre  notation). Optionally, a default value can be included by adding a colon followed by the default string.  Tempalte placeholders support both truthy conditional blocks and list/dict iterator blocks. Additionally, tempalte placeholders may contain an optional prefix.\n\n\n###Block Constructs: [ [\\#, ~, ^, !]{propertyName} ]\nBlocks begin with an opening tag and end with a closing tag, and may span multiple lines.  Opening block tags must contain one of the following prefixes preceeding the {propertyName}.\n* \\# (iterator block)\n  * If the propertyName represents an object or array, repeat the block with the value of each element.  Otherwise, repeat the block with the full object.\n\n* ~ (truthy block)\n  * Render the block if the propertyName exists and is truthy.\n\n* ^ (falsy block)\n  * Render the block if the propertyName does not exists or is falsy.\n\n* ! (falsy bock)\n  * Render the block if the propertyName does not exists or is falsy.\n\n\n###Special placeholder names:\n* KEY/INDEX - the current property name or index in a iterator.  In a logical block this is the logical key name.\n* VALUE - The current property or item value in an iterator. In a logical block this is the boolean value.\n\n\n###Rendering a template:\n```js\nvar bracket = require('bracket-templates');\nvar data = {\n  thing: \"World\"\n};\n\nconsole.log( bracket.render('Hello [thing]. I like [ color : green ].', data) );\n```\n\nThis code would return the rendered string \"Hello World. I like green.\"  Since there is no property \"color\" in the data object, the default value is used.\n\nWhitespace inside tag brackets is generally ignored, but preserved inside the context of the {defaultValue}.  Both tags\n`[name:default]` and `[ name : default ]` are equivalent.\n\n\n###Examples:\n\n----\n\n**A basic template with some default text.**\n```text\n[ name : Joe Somebody ]\n[ address ]\n[ phone ]\n```\n**Code:**\n```js\nvar bracket = require('bracket-templates');\nvar template = fs.readFileSync('./template.txt');\nvar data = {\n  name: false,\n  addres: '123 Any Street, Anytowne, OH',\n  phone: 5551212\n};\nconsole.log( bracket.render( String(template), data ) );\n```\n\n\n----\n\n**A templalte using the optional prefix 'object'.**\n```text\nHello [ object-name ]\n```\n**Code:**\n```js\nvar bracket = require('bracket-templates');\nvar template = fs.readFileSync('./template.txt');\nvar data = {\n  name: 'Joe User'\n};\nconsole.log( bracket.render( String(template), data, {prefix: 'object'} ) );\n```\n\n\n----\n\n**A template using dot based sub-key notation (alternately, hyphens and underscores are supported)**\n```\nHello [ company.employees.0.name : mindless worker ].\n```\n**Code:**\n```js\nvar bracket = require('bracket-templates');\nvar template = fs.readFileSync('./template.txt');\nvar data = {\n  company: {\n    employees: [{\n      name: 'Joe User'\n    }]\n  }\n};\nconsole.log( bracket.render( String(template), data ) );\n```\n\n\n----\n\n**An iterator block using sub-key notation.**\n```\nEmployees:\n[ #company.employees ]\n  name: [ name ]\n[ /company.employees ]\n```\n**Code:**\n```js\nvar bracket = require('bracket-templates');\nvar template = fs.readFileSync('./template.txt');\nvar data = {\n  company: {\n    employees: [{\n      name: 'Joe Worker'\n    },{\n      name: 'Jane Person'\n    }]\n  }\n};\nconsole.log( bracket.render( String(template), data ) );\n```\n\n\n----\n\n**An object iterator using specials.**\n```\n[ #properties ]\n  [ KEY ]: [ VALUE ]\n[ /properties ]\n```\n**Code:**\n```js\nvar bracket = require('bracket-templates');\nvar template = fs.readFileSync('./template.txt');\nvar data = {\n  properties: {\n    name: 'Joe User',\n    age: 37\n  }\n};\nconsole.log( bracket.render( String(template), data ) );\n```\n\n\n----\n\n**A truthy conditional block.**\n```\n[ ~taxable ]\n  Please cut off your leg.\n[ /taxable ]\n```\n**Code:**\n```js\nvar bracket = require('bracket-templates');\nvar template = fs.readFileSync('./template.txt');\nvar data = {\n  taxable: 'yes'\n};\nconsole.log( bracket.render( String(template), data ) );\n```\n\n\n----\n\n**A falsy conditional block.**\n```\n[ ^taxable ]\n  Aren't you lucky!\n[ /taxable ]\n\nor\n\nYou are [ !taxable ] not [ /taxable ] taxable.\n\n```\n**Code:**\n```js\nvar bracket = require('bracket-templates');\nvar template = fs.readFileSync('./template.txt');\nvar data = {};\nconsole.log( bracket.render( String(template), data ) );\n```\n\n\n----\n\n**A truthy conditional iterator block.**\n```\n[ #taxable ]\n  You owe [ taxRate : 100% ] of your income.\n[ /taxable ]\n```\n**Code:**\n```js\nvar bracket = require('bracket-templates');\nvar template = fs.readFileSync('./template.txt');\nvar data = {\n  taxable: {\n    taxRate: '99%'\n  }\n};\nconsole.log( bracket.render( String(template), data ) );\n```\n\n\n----\n\n**Escaping some literal bracket text.**\n```\nExample: \\[ someName ] would render [ someName ]\n\nAllternately \\[ someName \\] will render [ someName ]\n```\n**Code:**\n```js\nvar bracket = require('bracket-templates');\nvar template = fs.readFileSync('./template.txt');\nvar data = {\n  someName: 'Test'\n};\nconsole.log( bracket.render( String(template), data ) );\n```\n\n\n_Please report any issues_\n","maintainers":[{"name":"joelbair","email":"joe.a.bair@gmail.com"}],"time":{"modified":"2022-06-13T05:03:43.849Z","created":"2014-05-19T19:02:55.576Z","0.0.1":"2014-05-19T19:02:57.213Z","0.0.2":"2014-05-19T19:08:03.749Z","0.0.3":"2014-07-02T21:17:47.582Z","0.0.4":"2014-07-03T20:03:36.781Z","0.0.5":"2014-07-03T20:35:17.591Z","0.0.6":"2014-07-03T20:54:42.611Z","0.0.7":"2014-09-20T00:35:14.429Z","0.0.8":"2014-10-02T19:30:39.205Z","0.0.9":"2016-01-13T20:10:34.112Z","0.1.0":"2017-11-28T23:38:52.145Z"},"readmeFilename":"README.md","keywords":["template","square brackets","brackets","bracket","templates"],"repository":{"type":"git","url":"git+https://github.com/joelabair/Bracket-Templates.git"},"author":{"name":"joel.a.bair@gmail.com"},"bugs":{"url":"https://github.com/joelabair/Bracket-Templates/issues"},"license":"GPLv2","users":{"joelbair":true},"homepage":"https://github.com/joelabair/Bracket-Templates#readme"}