{"_id":"express-expose","_rev":"27-98fb3df9ad0224c120c1963b0bfdf11b","name":"express-expose","description":"Expose helpers and local variables to the client-side","dist-tags":{"latest":"0.3.4"},"versions":{"0.0.1":{"name":"express-expose","version":"0.0.1","description":"Expose helpers and local variables to the client-side","keywords":["express"],"author":{"name":"TJ Holowaychuk","email":"tj@vision-media.ca"},"dependencies":{},"main":"index","engines":{"node":"0.4.x"},"_id":"express-expose@0.0.1","_engineSupported":true,"_npmVersion":"0.3.15","_nodeVersion":"v0.4.5","directories":{"lib":"./lib"},"files":[""],"_defaultsLoaded":true,"dist":{"shasum":"9883133fcfcbaa117bb763224cd400a40fc47a38","tarball":"https://registry.npmjs.org/express-expose/-/express-expose-0.0.1.tgz","integrity":"sha512-nMtjN+DkWXCyB3nPRWoJgvEzokaIlXMUyh5SqIycAOKlCwJnNjPDcUWlKbN94wlzFh/u6C/tqvzMFm4oAbjMXw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCKbjujJZg4AwX/veL8uoRrXDXIutkHHhLkiO/hlkCSbgIhAJoY47W7NtWZTXWkTv0xkweTsNNsjGop2bpqwva5jCcJ"}]}},"0.1.0":{"name":"express-expose","version":"0.1.0","description":"Expose helpers and local variables to the client-side","keywords":["express"],"author":{"name":"TJ Holowaychuk","email":"tj@vision-media.ca"},"dependencies":{},"main":"index","engines":{"node":"0.4.x"},"_id":"express-expose@0.1.0","_engineSupported":true,"_npmVersion":"0.3.15","_nodeVersion":"v0.4.5","directories":{"lib":"./lib"},"files":[""],"_defaultsLoaded":true,"dist":{"shasum":"9fed9a7676cabd898310a772562f0286c7a6a5c5","tarball":"https://registry.npmjs.org/express-expose/-/express-expose-0.1.0.tgz","integrity":"sha512-41zWRwRQGscbaYjv90BpNrBYodKujJnMICwX66UTpb8wUjTGwDNTdrMDP0K/bBKE5qCQim3awqncAjsAxhKFOA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD1DC3mQkYaCyuw0Z581QNZsy8QriALPG+9eVgyJ4jZHgIgIy18lGnHgUB26QMA/hyvctRn9Y1PreHc9kjTg3gChKQ="}]}},"0.2.0":{"name":"express-expose","version":"0.2.0","description":"Expose helpers and local variables to the client-side","keywords":["express"],"author":{"name":"TJ Holowaychuk","email":"tj@vision-media.ca"},"dependencies":{},"main":"index","engines":{"node":"0.4.x"},"_id":"express-expose@0.2.0","_engineSupported":true,"_npmVersion":"0.3.18","_nodeVersion":"v0.4.6","directories":{"lib":"./lib"},"files":[""],"_defaultsLoaded":true,"dist":{"shasum":"5998925a4e7c8688fe0968c41f0486951b8e0cb1","tarball":"https://registry.npmjs.org/express-expose/-/express-expose-0.2.0.tgz","integrity":"sha512-Nr71KinZTwQr8LqQfxxFMVNZdFp8X8fJrCghuPp0iw2gWrazqMYpgPqteiSWAm6+Hv8DkO+uaiAsN7JgZrdAHg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA5LOgvuvNgJPJ3lejsVeArP4XMfjQbtrHw/P9cMkB2VAiBjRShWIzI+SE/KuLjUX25zURiYtylO32gzwR56H15mNw=="}]}},"0.2.1":{"name":"express-expose","version":"0.2.1","description":"Expose helpers and local variables to the client-side","keywords":["express"],"author":{"name":"TJ Holowaychuk","email":"tj@vision-media.ca"},"devDependencies":{"connect":"1.8.x","express":"2.5.x","mocha":"*","should":"*","jade":"*"},"main":"index","engines":{"node":">= 0.4.x < 0.8.x"},"_npmUser":{"name":"tjholowaychuk","email":"tj@vision-media.ca"},"_id":"express-expose@0.2.1","dependencies":{},"_engineSupported":true,"_npmVersion":"1.0.106","_nodeVersion":"v0.6.7","_defaultsLoaded":true,"dist":{"shasum":"dbc7d0e30fdbd934951ca72f526bb4956c52aa9e","tarball":"https://registry.npmjs.org/express-expose/-/express-expose-0.2.1.tgz","integrity":"sha512-vMvnzknAEe3cGTAjkw42+jNaDd7M36K4o73iINx8fpNQPOPjIUkPN3JI1NaM3LKfjBatqLQqoHsRKbXw4+2d+A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBPzhd0E52qCzBhJgzoKZJmatsDbhP9SEI87mitGO7LMAiB0PVAXnMwoLcGelnvVpeJr1lXuAiZomAyvPCD20aabRA=="}]},"maintainers":[{"name":"tjholowaychuk","email":"tj@vision-media.ca"}],"directories":{}},"0.2.2":{"name":"express-expose","version":"0.2.2","description":"Expose helpers and local variables to the client-side","keywords":["express"],"author":{"name":"TJ Holowaychuk","email":"tj@vision-media.ca"},"devDependencies":{"connect":"1.8.x","express":"2.5.x","mocha":"*","should":"*","jade":"*"},"main":"index","engines":{"node":">= 0.4.x < 0.8.x"},"_npmUser":{"name":"tjholowaychuk","email":"tj@vision-media.ca"},"_id":"express-expose@0.2.2","dependencies":{},"_engineSupported":true,"_npmVersion":"1.0.106","_nodeVersion":"v0.4.12","_defaultsLoaded":true,"dist":{"shasum":"35384f99110188f9761fb045be7a4db1228a235b","tarball":"https://registry.npmjs.org/express-expose/-/express-expose-0.2.2.tgz","integrity":"sha512-ShazQkBlmS58BEjX+J2l/JTljAP4fge0a3nPIpMukljmnakTCwygcBQ+0y5UrGxJJY5sZ+uoGHaUrvX7FRHHzg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCID88BvLUoF0p9Km+L4aL3FprY2DBlWmcyDjMWAbWvJ8FAiAp/+Ckja+EvtLMTHBHrZJVQ90o4k1CaW6yu9ipJYkfWA=="}]},"maintainers":[{"name":"tjholowaychuk","email":"tj@vision-media.ca"}],"directories":{}},"0.3.1":{"name":"express-expose","version":"0.3.1","description":"Expose helpers and local variables to the client-side","keywords":["express"],"author":{"name":"TJ Holowaychuk","email":"tj@vision-media.ca"},"devDependencies":{"express":"3.x","mocha":"*","should":"*","jade":"*"},"main":"index","_id":"express-expose@0.3.1","dist":{"shasum":"bbce88a646c882c2257cb965f9344c49f5e7e306","tarball":"https://registry.npmjs.org/express-expose/-/express-expose-0.3.1.tgz","integrity":"sha512-yEp6T4fFLL4i3Xz6T5kJyKhxcR1k/KjndciCpFp5PAUc6Q9Fr1q1x0iVw0jtgNmxKrPQ1hrraf3Go08fqWvbOQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCalq39VS1zelbjlZSRXCfiSuFNeI0btcMnGqHau9+u7QIgZwDT2p4wISAu2R9sBmE+jvLGe89w3QOh9LScwiyzQTw="}]},"maintainers":[{"name":"tjholowaychuk","email":"tj@vision-media.ca"}],"directories":{}},"0.3.2":{"name":"express-expose","version":"0.3.2","description":"Expose helpers and local variables to the client-side","keywords":["express"],"author":{"name":"TJ Holowaychuk","email":"tj@vision-media.ca"},"devDependencies":{"express":"3.x","mocha":"*","should":"*","jade":"*"},"main":"index","_id":"express-expose@0.3.2","dist":{"shasum":"3486d223cb74b10af543d95acd1a94d0027c3441","tarball":"https://registry.npmjs.org/express-expose/-/express-expose-0.3.2.tgz","integrity":"sha512-1x7X4ckyDS/SGvs1LxuYWz30LK8TV9JUbUvWgOggPY36qMW/x30PAuFrxCT9H0ZztVXXDU/ASCU34FNA4TW/fg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDJlR3WM6MDOwjtQeUA25uQy4N0X1qexFvOwL/vsXo2xQIhANN5ggbFZLlYajGgqthVk2FpsqXUvbT+m6iL3f0O16jw"}]},"maintainers":[{"name":"tjholowaychuk","email":"tj@vision-media.ca"}],"directories":{}},"0.3.3":{"name":"express-expose","version":"0.3.3","description":"Expose helpers and local variables to the client-side","keywords":["express"],"author":{"name":"TJ Holowaychuk","email":"tj@vision-media.ca"},"devDependencies":{"express":"3.x","mocha":"*","should":"*","jade":"*","supertest":"*"},"main":"index","_id":"express-expose@0.3.3","dist":{"shasum":"87ba3bf6eb1abfb3dfc7133fbcd992f052b66dc1","tarball":"https://registry.npmjs.org/express-expose/-/express-expose-0.3.3.tgz","integrity":"sha512-CkNVoXUcAHLyMsX/s3jUngREKqX9oOc9MOYtty55Sl0kRNZrvg6F0cq4zp/y0j6jjRGZit8JrmnnXcF5+s3tuw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEzYwa+vxFGOENhW6Av7qPweadkqL5hDb/+GqX/DcyibAiEA8YHGI73qdvRqsL093MEgBd/rk+DL9XN5xSel1N7oPQM="}]},"maintainers":[{"name":"tjholowaychuk","email":"tj@vision-media.ca"}],"directories":{}},"0.3.4":{"name":"express-expose","version":"0.3.4","scripts":{"prepublish":"npm prune","test":"NODE_ENV=test mocha --reporter spec --bail --check-leaks test/","test-cov":"NODE_ENV=test istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/","test-travis":"NODE_ENV=test istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"},"description":"Expose helpers and local variables to the client-side","keywords":["express"],"author":{"name":"TJ Holowaychuk","email":"tj@vision-media.ca"},"contributors":[{"name":"TJ Holowaychuk","email":"tj@vision-media.ca"},{"name":"Nick Baugh","email":"niftylettuce@gmail.com"}],"devDependencies":{"express":"4.x","mocha":"*","istanbul":"*","should":"*","jade":"*","supertest":"*"},"main":"index","repository":{"type":"git","url":"https://github.com/visionmedia/express-expose.git"},"gitHead":"4548e133130d9346c4c6c94b45f1f6863b58c965","bugs":{"url":"https://github.com/visionmedia/express-expose/issues"},"homepage":"https://github.com/visionmedia/express-expose","_id":"express-expose@0.3.4","_shasum":"a00338b75e03b1121a309e675518ca7af241b31d","_from":".","_npmVersion":"2.1.5","_nodeVersion":"0.10.32","_npmUser":{"name":"niftylettuce","email":"niftylettuce@gmail.com"},"maintainers":[{"name":"tjholowaychuk","email":"tj@vision-media.ca"},{"name":"niftylettuce","email":"niftylettuce@gmail.com"}],"dist":{"shasum":"a00338b75e03b1121a309e675518ca7af241b31d","tarball":"https://registry.npmjs.org/express-expose/-/express-expose-0.3.4.tgz","integrity":"sha512-4J5ywohZi2agSK7joawRSN7r/XP8v/BfGjeMld1Xq7COQ2ZCQAKSTbYPrHtQ4Sw5+EvtuRP41Cb4DsUTQgULYg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIClZhm/GKWaUCUA5TkNReJOYuFqtAdQN0QGFnsKjDCIkAiBvWW7T/bZR9GjDzQW+2tOvffMh1AhuzMHn5DJbu9csEg=="}]},"directories":{}}},"maintainers":[{"email":"niftylettuce@gmail.com","name":"niftylettuce"},{"email":"tj@vision-media.ca","name":"tjholowaychuk"},{"email":"npm@titanism.com","name":"titanism"}],"time":{"modified":"2022-06-17T22:17:05.993Z","created":"2011-04-08T17:25:41.361Z","0.0.1":"2011-04-08T17:25:41.695Z","0.1.0":"2011-04-08T20:24:59.109Z","0.2.0":"2011-04-21T00:52:40.156Z","0.2.1":"2012-01-18T23:40:37.784Z","0.2.2":"2012-02-10T00:00:43.984Z","0.3.1":"2012-07-27T17:16:45.060Z","0.3.2":"2012-07-30T16:33:59.007Z","0.3.3":"2012-08-14T18:02:45.941Z","0.3.4":"2014-11-30T18:34:00.480Z"},"author":{"name":"TJ Holowaychuk","email":"tj@vision-media.ca"},"users":{"fgribreau":true,"m42am":true},"keywords":["express"],"readme":"\n# express-expose\n\n[![NPM Version][npm-image]][npm-url]\n[![NPM Downloads][downloads-image]][downloads-url]\n[![Build Status][travis-image]][travis-url]\n[![Test Coverage][coveralls-image]][coveralls-url]\n\nExpose helpers and local variables to the client-side.\n\n\n## Install\n\n```bash\nnpm install -S express-expose\n```\n\n## Usage\n\n`express@4.x`:\n\n```js\nvar express = require('express');\nvar expose = require('express-expose');\napp = expose(app);\napp.expose(...);\n```\n\n`express@3.x` and `express@2.x`:\n\n```js\nvar express = require('express');\nvar expose = require('express-expose');\napp.expose(...);\n```\n\n\n## Versions\n\n* `express@4.x` (use `express-expose` at `>= 0.3.4`)\n* `express@3.x` (use `express-expose` at `>= 0.2.3` and `<= 0.3.3`)\n* `express@2.x` (use `express-expose` at `<= 0.2.2`)\n\n\n## Examples\n\n### Exposing Objects\n\nA common use-case for exposing objects to the client-side would be exposing some properties, perhaps the express configuration. The call to `app.expose(obj)` below defaults to exposing the properties to `app.*`, so for example `app.views`, `app.title`, etc.\n\n```js\napp.set('views', __dirname + '/views');\napp.set('view engine', 'jade');\napp.set('title', 'Example');\napp.set('default language', 'en');\n\napp.expose(app.settings);\n```\n\nAnother use-case would be exposing helper methods, perhaps the same ones as you are currently exposing to templates. Below we expose the `math` object as utilities to our templates, as well as the client-side. Within a template we would call `add(1,2)`, and on the CS we would call `utils.add(1,2)`, since we have passed the namespace \"utils\".\n\n```js\nvar math = { add: function(a,b){ return a + b; } };\napp.expose(math, 'utils').helpers(math);\n```\n\nSometimes you might want to output to a different area, so for this we can pass an additional param \"languages\" which tells express which buffer to write to, which ends up providing us with the local variable \"languages\" in our template, where the default is \"javascript\". The \"app\" string here is the namespace.\n\n```js\napp.expose({ en: 'English', fr: 'French' }, 'app', 'languages');\n```\n\nYou'll then want to output the default buffer (or others) to your template, in Jade this would look something like:\n\n```jade\nscript!= javascript\n```\n\nAnd in EJS:\n\n```html\n<script><%- javascript %></script>\n```\n\n### Raw JavaScript\n\nIt is also possible to expose \"raw\" javascript strings.\n\n```js\napp.expose('var some = \"variable\";');\n```\n\nOptionally passing the destination buffer, providing us with the \"head\" local variable, instead of the default of \"javascript\".\n\n```js\napp.expose('var some = \"variable\";', 'head');\n```\n\n### Exposing Functions\n\nExposing a named function is easy too, simply pass it in with an optional buffer name for placement within a template much like above.\n\n```js\napp.expose(function someFunction(){\n  return 'yay';\n}, 'foot');\n```\n\n### Self-Calling Functions\n\nAnother alternative is passing an anonymous function, which executes itself, creating a \"wrapper\" function.\n\n```js\napp.expose(function(){\n  function notify() {\n    alert('this will execute right away :D');\n  }\n  notify();\n});\n```\n\n### Request-Level Exposure\n\nFinally we can apply all of the above at the request-level as well, below we expose \"app.current.user\" as `{ name: 'tj' }`, for the specific request only.\n\n```js\napp.get('/', function(req, res){\n  var user = { name: 'tj' };\n  res.expose(user, 'app.current.user');\n  res.render('index', { layout: false });\n});\n```\n\n\n## License\n\n[MIT](LICENSE)\n\n[npm-image]: https://img.shields.io/npm/v/express-expose.svg?style=flat\n[npm-url]: https://npmjs.org/package/express-expose\n[travis-image]: https://img.shields.io/travis/expressjs/express-expose.svg?style=flat\n[travis-url]: https://travis-ci.org/expressjs/express-expose\n[coveralls-image]: https://img.shields.io/coveralls/expressjs/express-expose.svg?style=flat\n[coveralls-url]: https://coveralls.io/r/expressjs/express-expose?branch=master\n[downloads-image]: http://img.shields.io/npm/dm/express-expose.svg?style=flat\n[downloads-url]: https://npmjs.org/package/express-expose\n","readmeFilename":"Readme.md","homepage":"https://github.com/visionmedia/express-expose","repository":{"type":"git","url":"https://github.com/visionmedia/express-expose.git"},"contributors":[{"name":"TJ Holowaychuk","email":"tj@vision-media.ca"},{"name":"Nick Baugh","email":"niftylettuce@gmail.com"}],"bugs":{"url":"https://github.com/visionmedia/express-expose/issues"}}