{"name":"pug-attrs","version":"3.0.0","description":"Generate code for Pug attributes","keywords":["pug"],"dependencies":{"constantinople":"^4.0.1","js-stringify":"^1.0.2","pug-runtime":"^3.0.0"},"repository":{"type":"git","url":"https://github.com/pugjs/pug/tree/master/packages/pug-attrs"},"author":{"name":"Forbes Lindesay"},"license":"MIT","_id":"pug-attrs@3.0.0","_nodeVersion":"12.16.3","_npmVersion":"6.14.4","dist":{"integrity":"sha512-azINV9dUtzPMFQktvTXciNAfAuVh/L/JCl0vtPCwvOA21uZrC08K/UnmrL+SXGEVc1FwzjW62+xw5S/uaLj6cA==","shasum":"b10451e0348165e31fad1cc23ebddd9dc7347c41","tarball":"http://registry-npm.ywwl.com/pug-attrs/download/pug-attrs-3.0.0.tgz","fileCount":4,"unpackedSize":7916,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJey7fBCRA9TVsSAnZWagAA110P/1/5IGW3WnBj8Vt8WJwl\nNvV4lkXZOzuHLqQUhirSj5wsDq8qfnw8nDE8K9g/NMvpIRgl1JOz4RoTj5op\nPe1snnlbjbobNTkqU2y1DcH8COOvOnxqD16xNvKmZTfrdKp9lDEJ7HtP3kB/\ne58b12qW7x4xw02aV08rc0jN3JdjujDNA3IfkodsajVS400Vgt+UIPg0RS0n\n/0/dj32mRKmR2GPEo3Ix3d3Dl8JPg/DNoL/w1PozS3osihue7olUJAHIT+XJ\n6fk40dAfIZG6FxzXyBPAjQPGWDMnkcIF3mC2FtHi0AteMXRiMIJM9H1lwTrK\nCKffZCUeTtKxqZ51MiHt0PiQ72WDHKl1saiISDmXxu3czn85irTTW+QqOpfu\nGlUIuEqNvYVuzMHwzIvfkii9bXUHyCdIu5j+Ib9v8/jNRkVa79htyT6HExBc\nkScOl/9iIgA6Lbx+O6gqmqQ8i/9+WpFuUQuja0qIH1Ngq5sS9EQb/SSZ5ptV\n+qSU+cS8i2ys5oLHDQCy9v4m4Ryuf+aMME0x4JtWHTnVtfwZxNcoMNb0l3fS\n4vz/rXYJWRWwVKTQBqLB55FuV5ChCdG1AtoEvlnbejHq5oTu0NQCgl2W369M\nHbqAS4PJYQlVzNJDv91WofnMxAL17szSUPPB525OAto/irqWqDh00WMwzb4m\nGAO0\r\n=TEdX\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHbBuy5lHkFQ3fBNxrteIkwVl4NOhEdtxA3Sv0K1GKxJAiEA/+wELYXKpJ5P3NmZjKvSsT86Jb1RuJLDwvOV3pgXoNk="}],"size":2992,"noattachment":false,"key":"/pug-attrs/-/pug-attrs-3.0.0.tgz"},"maintainers":[{"email":"forbes@lindesay.co.uk","name":"forbeslindesay"},{"email":"pug-bot@rollingversions.com","name":"pug-bot"},{"email":"timothygu99@gmail.com","name":"timothygu"}],"_npmUser":{"name":"pug-bot","email":"pug-bot@rollingversions.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pug-attrs_3.0.0_1590409152602_0.6344248320140216"},"_hasShrinkwrap":false,"readme":"# pug-attrs\n\nGenerate code for Pug attributes\n\n[![Build Status](https://img.shields.io/travis/pugjs/pug-attrs/master.svg)](https://travis-ci.org/pugjs/pug-attrs)\n[![Dependencies Status](https://david-dm.org/pugjs/pug/status.svg?path=packages/pug-attrs)](https://david-dm.org/pugjs/pug?path=packages/pug-attrs)\n[![NPM version](https://img.shields.io/npm/v/pug-attrs.svg)](https://www.npmjs.org/package/pug-attrs)\n\n## Installation\n\n    npm install pug-attrs\n\n## Usage\n\n```js\nvar compileAttrs = require('pug-attrs');\n```\n\n### `compileAttrs(attrs, options)`\n\nCompile `attrs` to a JavaScript string that evaluates to the attributes in the desired format.\n\n`options` MUST include the following properties:\n\n- `terse`: whether or not to use HTML5-style terse boolean attributes\n- `runtime`: callback that takes a runtime function name and returns the source code that will evaluate to that function at runtime\n- `format`: output format; must be `html` or `object`\n\n`attrs` is an array of attributes, with each attribute having the form of `{ name, val, mustEscape }`. `val` represents a JavaScript string that evaluates to the value of the attribute, either statically or dynamically.\n\n```js\nvar compileAttrs = require('pug-attrs');\nvar pugRuntime = require('pug-runtime');\n\nfunction getBaz () { return 'baz<>'; }\n\nvar attrs = [\n  {name: 'foo',  val: '\"bar\"',    mustEscape: true },\n  {name: 'baz',  val: 'getBaz()', mustEscape: true },\n  {name: 'quux', val: true,       mustEscape: false}\n];\nvar result, finalResult;\n\n// HTML MODE\nresult = compileAttrs(attrs, {\n  terse:   true,\n  format:  'html',\n  runtime: function (name) { return 'pugRuntime.' + name; }\n});\n//=> '\" foo=\\\\\"bar\\\\\"\" + pugRuntime.attr(\"baz\", getBaz(), true, true) + \" quux\"'\n\nfinalResult = Function('pugRuntime, getBaz',\n  'return (' + result + ');'\n);\nfinalResult(pugRuntime, getBaz);\n// => ' foo=\"bar\" baz=\"baz&lt;&gt;\" quux'\n\n// OBJECT MODE\nresult = compileAttrs(attrs, {\n  terse:   true,\n  format:  'object',\n  runtime: function (name) { return 'pugRuntime.' + name; }\n});\n//=> '{\"foo\": \"bar\",\"baz\": pugRuntime.escape(getBaz()),\"quux\": true}'\n\nfinalResult = Function('pugRuntime, getBaz',\n  'return (' + result + ');'\n);\nfinalResult(pugRuntime, getBaz);\n//=> { foo: 'bar', baz: 'baz&lt;&gt;', quux: true }\n```\n\n## License\n\n  MIT\n","publish_time":1590409152854,"_cnpm_publish_time":1590409152854,"dist-tags":{"canary":"3.0.0-canary-2","latest":"3.0.0"}}