{"_id":"mold-template","_rev":"9-b80984ee15d6c00a447fca73985eb0b1","name":"mold-template","description":"Tiny templating tool","dist-tags":{"latest":"2.0.2"},"versions":{"1.0.0":{"name":"mold-template","version":"1.0.0","main":"mold.node.js","description":"Templating system","licenses":[{"type":"MIT","url":"http://marijnhaverbeke.nl/mold/LICENSE"}],"bugs":"https://github.com/marijnh/mold/issues","scripts":{"test":"node ./test.js"},"keywords":["templating","client-side"],"homepage":"http://marijnhaverbeke.nl/mold","author":{"name":"Marijn Haverbeke","email":"marijnh@gmail.com"},"repositories":[{"type":"git","url":"https://github.com/marijnh/mold.git"}],"_id":"mold-template@1.0.0","dist":{"shasum":"22935a50754e9ebfa869575bcba77cff5977a02b","tarball":"https://registry.npmjs.org/mold-template/-/mold-template-1.0.0.tgz","integrity":"sha512-1zsMSvbru1libLsJVAD7uJkphhrML/CufwEYDog42PT8RMfaPGxjELy6S33NFPJd3tqgRYElRpIR2zpZHZrGTg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHtBWaV03fJkdiXNPIme1jJG0VhVhwonIFHPNXiB9wkCAiEAsXDSIxUbGjVnYU0hZsB8meuk736QbcUDDk5w5kr1fiU="}]},"_npmVersion":"1.1.59","_npmUser":{"name":"marijn","email":"marijnh@gmail.com"},"maintainers":[{"name":"marijn","email":"marijnh@gmail.com"}],"directories":{}},"2.0.0":{"name":"mold-template","version":"2.0.0","main":"mold.js","description":"Tiny templating tool","license":"MIT","bugs":{"url":"https://github.com/marijnh/mold/issues"},"scripts":{"test":"node ./test.js"},"keywords":["templating"],"author":{"name":"Marijn Haverbeke","email":"marijnh@gmail.com"},"repositories":[{"type":"git","url":"git+https://github.com/marijnh/mold.git"}],"gitHead":"7ffe82c2939f29afbb5c712a256559fd3f79c344","repository":{"type":"git","url":"git+https://github.com/marijnh/mold.git"},"homepage":"https://github.com/marijnh/mold#readme","_id":"mold-template@2.0.0","_shasum":"b1f901e2e5bf57aad0f000559da49bb882a0c7c9","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.2","_npmUser":{"name":"marijn","email":"marijnh@gmail.com"},"maintainers":[{"name":"marijn","email":"marijnh@gmail.com"}],"dist":{"shasum":"b1f901e2e5bf57aad0f000559da49bb882a0c7c9","tarball":"https://registry.npmjs.org/mold-template/-/mold-template-2.0.0.tgz","integrity":"sha512-hDrCHkXv9/oKh3Nmd4LZaNBDSwmFONt0+Fyxr02e6C+BLuaUv8Y2FUxtbYIQsldAvkGX4bjBjBC5eEG14JR9Mg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDsDQDNZeeOiy8SsFJxc64bUjrHKumXV9gk4efnPr+8WAiBSOhtqb/zqQa0YRpjl1pmNm1rwZmkxnr5teHyhX3oZ8w=="}]},"directories":{}},"2.0.1":{"name":"mold-template","version":"2.0.1","main":"mold.js","description":"Tiny templating tool","license":"MIT","bugs":{"url":"https://github.com/marijnh/mold/issues"},"scripts":{"test":"node ./test.js"},"keywords":["templating"],"author":{"name":"Marijn Haverbeke","email":"marijnh@gmail.com"},"repositories":[{"type":"git","url":"git+https://github.com/marijnh/mold.git"}],"gitHead":"666de26a0d9d9704570e4f3e6de9325910fe1615","repository":{"type":"git","url":"git+https://github.com/marijnh/mold.git"},"homepage":"https://github.com/marijnh/mold#readme","_id":"mold-template@2.0.1","_shasum":"9dff6d8fac47a0049dfe3084b89098564e15b607","_from":".","_npmVersion":"3.9.3","_nodeVersion":"6.2.1","_npmUser":{"name":"marijn","email":"marijnh@gmail.com"},"maintainers":[{"name":"marijn","email":"marijnh@gmail.com"}],"dist":{"shasum":"9dff6d8fac47a0049dfe3084b89098564e15b607","tarball":"https://registry.npmjs.org/mold-template/-/mold-template-2.0.1.tgz","integrity":"sha512-B/d9PNfFoSm6Z4koL+fCvUKlTJJTBZqKWNjcBC5L6R0TNnFUi0GjuTsyT49H7Jw7GEMMxnrJZg2iLo1KbUXh4g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDdSk1FM/UiIwQ+IDQ+3rZpW+v7QStb6/YRxls4KEQtXQIgXdZ1akK1wYG+qMP5uUbSoOU4iNYIGh0Jki3ERAruUYc="}]},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/mold-template-2.0.1.tgz_1467110767823_0.21940707648172975"},"directories":{}},"2.0.2":{"name":"mold-template","version":"2.0.2","main":"mold.js","description":"Tiny templating tool","license":"MIT","bugs":{"url":"https://github.com/marijnh/mold/issues"},"scripts":{"test":"node ./test.js"},"keywords":["templating"],"author":{"name":"Marijn Haverbeke","email":"marijnh@gmail.com"},"repositories":[{"type":"git","url":"git+https://github.com/marijnh/mold.git"}],"gitHead":"c029ff12758e1ae398004e8b023b4516dade5bc4","repository":{"type":"git","url":"git+https://github.com/marijnh/mold.git"},"homepage":"https://github.com/marijnh/mold#readme","_id":"mold-template@2.0.2","_nodeVersion":"15.5.0","_npmVersion":"7.3.0","dist":{"integrity":"sha512-8VqPPC8l3MtB5rrkekA/CKINh+X18KumW2lCr2xId8cP6bxONUOEhQW+cYM8gfsuS1A8bYo1w122/vyFsuWYaQ==","shasum":"dce15fa1159e91682bae436cf396d340fb7bd779","tarball":"https://registry.npmjs.org/mold-template/-/mold-template-2.0.2.tgz","fileCount":5,"unpackedSize":12897,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf6fY7CRA9TVsSAnZWagAAm6QP/R53nfq97hbFR5scLcdD\nEWyCXB/lEDkhnrAQC6kaXZBn1PD697tJed9QJq72amJEpzoPIGZLItYriM+2\nGJHXamHqbWQM8k73k6u5kzZvz2gAnMs8OdWxfCCd205ok0q1zs45eciB/da1\nvvO7ow+Y1G8lVruBBwcZYdS2LxkCC7W0I0DZ4paNO+R23j7i+/mEirVmeRyD\nJsmTJ5n4QzE9Lc0+P3XefcFHi3Vt9z1PNz0oq5RcqXwdNIJfT+xXGt/+mBTM\n08QKGPyBemgF2gEEdIA5IwDwKvZNvGQvRoLGpMa9XlejurSnJ29tdTg4ujM+\nUjXb3QbTFCvJf6qNWj5Bp3sflmL2vkEBzYDHzNz0y6FeDoZzVMVoi9aiE+DJ\nvaDY4/QOZSnB+PBa4g8hMtQBYQSGhfbUDdEv3Ta8ZtVEKhJem/x7jScIvRR3\n12LD24sO5iS1maDFixUR2tBdkq4fWJYjB8bF/laqWIGh+9LNE6m0Xk4cRtzz\nqcXix67XgWaieqyObKpzYu2+BNb+UslwjiYlX9va4Q+yQRvVzwTr/rDtJJxG\ntcm0lDsK4wVScUBEFqreaH6oyvKE8oXk5aIEtSwYCyG7+EQRNJndcbBdl7/p\nSY2b0Hy6SpoSdvVI95sdwS1aNYs+Sh2NdTn+LSZiE2YYJfqiohZH4tH1FtfR\noL24\r\n=GJzq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE0X7vLg8170Yq668633QFN0/Qb9CztgYR9PSr9MLtfMAiEA1dX8hkULCVsD+NHDXZffzBoli9zlD0fZiNNsDm6hovI="}]},"_npmUser":{"name":"marijn","email":"marijnh@gmail.com"},"directories":{},"maintainers":[{"name":"marijn","email":"marijnh@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mold-template_2.0.2_1609168442567_0.859550000248396"},"_hasShrinkwrap":false}},"readme":"# Mold templating library\n\nMold is a minimalist templating library that compiles strings\ncontaining templating directives to functions that instantiate the\ntemplate.\n\nMold's directives are surrounded by `<<` and `>>`.\nThe simplest commands are `<<t EXPR>>` (also `<<text >>`), which\ninserts the result of the given JavaScript expression and HTML-escapes\nit in the process, and `<<h EXPR>>` (also `<<html >>`) which inserts\nthe given expression as-is, without escaping.\n\n    <p>Hello <<t $in.user>>, your score is <<t $in.score>>.</p>\n\nSimple control flow can be performed as follows:\n\n    <ul>\n      <<for x arrayEXPR>>\n        <li><<if typeof x == \"string\">>\n          <<t x>>\n        <<elif x == null>>\n          (missing)\n        <<else>>\n          <<t x.render()>>\n        <</if>></li>\n      <</for>>\n    </ul>\n\nInside `for` constructs, `$i` is bound to the index of the current\nitem. A similar construct, `<<for key, value in objEXPR>>` can be used\nto iterate over object properties.\n\n## API\n\nMold templates are _baked_ (precompiled) before they are instantiated.\nTo bake a template, you need a `Mold` object.\n\n    var Mold = require(\"mold-template\")\n    var mold = new Mold({myGlobal: \"hi\"})\n\nA `Mold` object takes an optional scope object, whose properties are\nvisible as variables to the code in all templates baked by that\nobject.\n\nIt has a `bake` property:\n\n    var template = mold.bake(\"mytemplate\", \"hi <<t $in.name>>\")\n    console.log(template({name: \"Sue\"}))\n    // → \"hi Sue\"\n\nA baked template is a function from an input value to a string. The\ninput value provides the `$in` variable inside the template. You can\nalso unpack with an `in` directive:\n\n    <<in {name, score}>>\n    <p>Hello <<t name>>, your score is <<t score>>.</p>\n\n`in` only understands plain object literals (with only property names\nin them) and variable names (`<<in item>>`), except when your JS\nengine supports ES6 destructuring, in which case you can use all the\npatterns, nesting, and defaulting that the language supports.\n\nYou can define your own directives with the `defs` property of a\n`Mold` object. All templates baked with `bake`, when a name was\nspecified for them, are automatically available under their name. You\ncan also add your own functions that return strings.\n\n    mold.defs.caps = function(val) { return String(val).toUpperCase() }\n    console.log(mold.bake(\"say <<caps $in>>?\")(\"what\"))\n    // → \"say WHAT?\"\n\n## Community\n\nThis software is released under an MIT license. You are invited to\nreport bugs or submit patches via\n[GitHub](http://github.com/marijnh/mold/).\n","maintainers":[{"name":"marijn","email":"marijnh@gmail.com"}],"time":{"modified":"2022-06-20T04:53:18.210Z","created":"2012-11-05T10:53:13.634Z","1.0.0":"2012-11-05T10:53:16.712Z","2.0.0":"2015-12-16T14:18:47.749Z","2.0.1":"2016-06-28T10:46:10.400Z","2.0.2":"2020-12-28T15:14:02.766Z"},"author":{"name":"Marijn Haverbeke","email":"marijnh@gmail.com"},"homepage":"https://github.com/marijnh/mold#readme","keywords":["templating"],"repository":{"type":"git","url":"git+https://github.com/marijnh/mold.git"},"bugs":{"url":"https://github.com/marijnh/mold/issues"},"license":"MIT","readmeFilename":"README.md"}