{"_id":"bulk-require","_rev":"18-647a866cbf1f7ca41b1c849c70351949","name":"bulk-require","description":"require a whole directory of trees in bulk","dist-tags":{"latest":"1.0.1"},"versions":{"0.0.0":{"name":"bulk-require","version":"0.0.0","description":"require whole directory trees in bulk","main":"index.js","dependencies":{"glob":"~3.2.7"},"devDependencies":{"tape":"~2.3.2"},"scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"git://github.com/substack/bulk-require.git"},"homepage":"https://github.com/substack/bulk-require","keywords":["require","bulk","directory","glob","load","include"],"author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"license":"MIT","bugs":{"url":"https://github.com/substack/bulk-require/issues"},"_id":"bulk-require@0.0.0","dist":{"shasum":"44745dbf2c8bb3a86a59d538f403ae9ebedbdafd","tarball":"https://registry.npmjs.org/bulk-require/-/bulk-require-0.0.0.tgz","integrity":"sha512-S6cdsyhvWQbAhaUSJk/z+Y7f0FDxI81bk9wZeAQptaJgdD4D5A0zBt2v8PFqR1oZzZ+kfszeHGVn3TW1+1aX6g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDLnoj6y53ENfLXzkE6Fy1PVbj0BxZB1fR2M+Fr2r5/ogIgfcBo3n7EtkGMxSr2Br+MPpjYnp7oSDOTRLh9WzJWATE="}]},"_from":".","_npmVersion":"1.3.21","_npmUser":{"name":"substack","email":"mail@substack.net"},"maintainers":[{"name":"substack","email":"mail@substack.net"}],"directories":{}},"0.0.1":{"name":"bulk-require","version":"0.0.1","description":"require a whole directory of trees in bulk","main":"index.js","dependencies":{"glob":"~3.2.7"},"devDependencies":{"tape":"~2.3.2"},"scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"git://github.com/substack/bulk-require.git"},"homepage":"https://github.com/substack/bulk-require","keywords":["require","bulk","directory","glob","load","include"],"author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"license":"MIT","bugs":{"url":"https://github.com/substack/bulk-require/issues"},"_id":"bulk-require@0.0.1","dist":{"shasum":"726be529da0fed476bfca9dc678240569d9b83fe","tarball":"https://registry.npmjs.org/bulk-require/-/bulk-require-0.0.1.tgz","integrity":"sha512-BdLDSH/wYC7qWSg8OAbjiS/l/gG9BbRTJF60B78X5twzJ00/xpFNjow7qkWuR3kKpyqskZnF8AEgMxBpKpU93w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCcKpMbO0yUHuDGAnUvyAv7KmddTHSVmCvVGH8FWQB2bgIhAKc3FWWq5mHnoyTHXV93oHG96oozUewFDUgzFp3GN4l8"}]},"_from":".","_npmVersion":"1.3.21","_npmUser":{"name":"substack","email":"mail@substack.net"},"maintainers":[{"name":"substack","email":"mail@substack.net"}],"directories":{}},"0.1.0":{"name":"bulk-require","version":"0.1.0","description":"require a whole directory of trees in bulk","main":"index.js","dependencies":{"glob":"~3.2.7"},"devDependencies":{"tape":"~2.3.2"},"scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"git://github.com/substack/bulk-require.git"},"homepage":"https://github.com/substack/bulk-require","keywords":["require","bulk","directory","glob","load","include"],"author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"license":"MIT","bugs":{"url":"https://github.com/substack/bulk-require/issues"},"_id":"bulk-require@0.1.0","dist":{"shasum":"76060ec74b9663f9d447d1e4e981890eebf52bc7","tarball":"https://registry.npmjs.org/bulk-require/-/bulk-require-0.1.0.tgz","integrity":"sha512-p+HdFhJv4B//cjt289jCvuyL3xJTSdk5n41lXJ2FaclF20BQQI8gw0EAyGUX7IPg5PR8uYRt44cpB2L1V9+6FA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHfo3Kq5KLPFIJ8oZSEG/iU1TQeqJx7aeEzNONuLSUn3AiB40NsndB8nkJDrEweqNzJggowUyIXmuw8Hobaxhg6ljQ=="}]},"_from":".","_npmVersion":"1.3.21","_npmUser":{"name":"substack","email":"mail@substack.net"},"maintainers":[{"name":"substack","email":"mail@substack.net"}],"directories":{}},"0.2.0":{"name":"bulk-require","version":"0.2.0","description":"require a whole directory of trees in bulk","main":"index.js","dependencies":{"glob":"~3.2.7"},"devDependencies":{"tape":"~2.3.2"},"scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"git://github.com/substack/bulk-require.git"},"homepage":"https://github.com/substack/bulk-require","keywords":["require","bulk","directory","glob","load","include"],"author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"license":"MIT","bugs":{"url":"https://github.com/substack/bulk-require/issues"},"_id":"bulk-require@0.2.0","_shasum":"3ea700a07355f70aa6007284a6dda59a03fcc91d","_from":".","_npmVersion":"1.4.7","_npmUser":{"name":"substack","email":"mail@substack.net"},"maintainers":[{"name":"substack","email":"mail@substack.net"}],"dist":{"shasum":"3ea700a07355f70aa6007284a6dda59a03fcc91d","tarball":"https://registry.npmjs.org/bulk-require/-/bulk-require-0.2.0.tgz","integrity":"sha512-/bMfmFtd9kiZISIukekcP3CCz5pTwNeT/d5GwFkihZ3554KT1D3Ndiq4ub9qsvoeoSoUSEwfBC3RbJb+NFrLUA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDIAxLpJ5bxszvl4F8qe00jIwEFu5fb/LrQeBPcJ1GVRAiEAnpTu8wYxt3iPyCRfWE1nC+3S+6bmvNhYeoMKk7oG7Xo="}]},"directories":{}},"0.2.1":{"name":"bulk-require","version":"0.2.1","description":"require a whole directory of trees in bulk","main":"index.js","dependencies":{"glob":"~3.2.7"},"devDependencies":{"tape":"^2.13.2"},"scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"git://github.com/substack/bulk-require.git"},"homepage":"https://github.com/substack/bulk-require","keywords":["require","bulk","directory","glob","load","include"],"author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"license":"MIT","bugs":{"url":"https://github.com/substack/bulk-require/issues"},"_id":"bulk-require@0.2.1","dist":{"shasum":"f118d7833118b0a1a20b465b136d9db513479d25","tarball":"https://registry.npmjs.org/bulk-require/-/bulk-require-0.2.1.tgz","integrity":"sha512-WdwGqhp60yU4Huvwp3bWtOo5LTD7P+ZFE86XMNUkFi3ocQGnwLjB9/LNpPbSiUb+ThbOEePklSNykRfHuRseHQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC5Ss+8AJgaq3qbNDP7FzDYBUASEL7xT6ki8Ku++uWHIQIhAMnqSDTw15vLemjqSFdLxNGADJ5W8AQwY1+1y4ZfI1Zr"}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"substack","email":"mail@substack.net"},"maintainers":[{"name":"substack","email":"mail@substack.net"}],"directories":{}},"1.0.0":{"name":"bulk-require","version":"1.0.0","description":"require a whole directory of trees in bulk","main":"index.js","dependencies":{"glob":"~3.2.7"},"devDependencies":{"tape":"^2.13.2"},"scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"git://github.com/substack/bulk-require.git"},"homepage":"https://github.com/substack/bulk-require","keywords":["require","bulk","directory","glob","load","include"],"author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"license":"MIT","gitHead":"1a5ff4665843a8a967e4e06be8db7d35abe92418","bugs":{"url":"https://github.com/substack/bulk-require/issues"},"_id":"bulk-require@1.0.0","_shasum":"7c84e9dd25a0377c0d0deaa92072307141b43ca8","_from":".","_npmVersion":"3.7.1","_nodeVersion":"5.5.0","_npmUser":{"name":"substack","email":"substack@gmail.com"},"dist":{"shasum":"7c84e9dd25a0377c0d0deaa92072307141b43ca8","tarball":"https://registry.npmjs.org/bulk-require/-/bulk-require-1.0.0.tgz","integrity":"sha512-oYnuvfzuczDb7byl7/jMcox7IIPzJ7IqQInwM4+qto2VhpbsFrRKwel7/z5C1gUUYvFCUmSetjZF7JPY1H+sSQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCCpu/Y/gOdIefapVPcdEqzmQjJOGQAjtEAGL1Y0tdYnwIgQg7uekj2TEnolGZVrtiJMoe0BHmZHje3HdC6HOXhtUs="}]},"maintainers":[{"name":"substack","email":"mail@substack.net"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/bulk-require-1.0.0.tgz_1466634214234_0.20192094682715833"},"directories":{}},"1.0.1":{"name":"bulk-require","version":"1.0.1","description":"require a whole directory of trees in bulk","main":"index.js","dependencies":{"glob":"^7.1.1"},"devDependencies":{"tape":"^4.6.2"},"scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"git://github.com/substack/bulk-require.git"},"homepage":"https://github.com/substack/bulk-require","keywords":["require","bulk","directory","glob","load","include"],"author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"license":"MIT","gitHead":"272006a16b8bbcc27a4204002d9b704670d0a863","bugs":{"url":"https://github.com/substack/bulk-require/issues"},"_id":"bulk-require@1.0.1","_shasum":"cb3d039e698139a444fc574b261d6b3b2cf44c89","_from":".","_npmVersion":"4.6.1","_nodeVersion":"6.10.2","_npmUser":{"name":"gmaclennan","email":"gmaclennan@digital-democracy.org"},"dist":{"shasum":"cb3d039e698139a444fc574b261d6b3b2cf44c89","tarball":"https://registry.npmjs.org/bulk-require/-/bulk-require-1.0.1.tgz","integrity":"sha512-BLU9AMnm1FMr68fR0sYvOkMew4x2ZJ8YztshITlGArl6aLtfAazOWiFj/bwJJixRO8C0wXx9PnRNRWeoR03e8Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA/qVWg8aWq58VogcvPCrT+Smv3K8gu3mnLsjqmo/u5gAiBKnzQ6ryEObsBff5v+NODhjiJPIp95yy8E431G0jSErQ=="}]},"maintainers":[{"name":"gmaclennan","email":"gmaclennan@digital-democracy.org"},{"name":"substack","email":"substack@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/bulk-require-1.0.1.tgz_1500412404673_0.7648165011778474"},"directories":{}}},"readme":"# bulk-require\n\nrequire a whole directory of trees in bulk\n\n[![build status](https://secure.travis-ci.org/substack/bulk-require.png)](http://travis-ci.org/substack/bulk-require)\n\n# example\n\n``` js\nvar bulk = require('bulk-require');\nvar sections = bulk(__dirname, [ 'data/**/*.js', 'render/*.js' ]);\nconsole.log(sections);\n```\n\nRunning this `glob.js` file in a directory with these contents:\n\n```\ndata/\n  cats/\n    index.js\n    meow/\n      x.js\n  dogs/\n    index.js\n    small/\n      yip.js\n    wolf/\n      doge.js\n  owners/\n    data.js\nglob.js\nrender/\n  xyz/\n    ignored.js\n  x.js\n```\n\nGives this output:\n\n```\n{ data: \n   { cats: { [Function] index: [Circular], meow: [Object] },\n     dogs: { [Function] index: [Circular], small: [Object], wolf: [Object] },\n     owners: { data: [Object] } },\n  render: { x: { oneoneone: 111, twotwotwo: 222 } } }\n```\n\n## bound arguments\n\nYou can also bind arguments by passing in an array instead of a glob string.\n\nFor example, if all `**/data.js` files have exports that take a `db` argument,\nyou can bind the arguments in bulk:\n\ndata/owners/data.js:\n\n``` js\nexports.all = function (db) {\n    return db.createReadStream({ start: 'owner!', end: 'owner!\\uffff' });\n};\n\nexports.one = function (db, name, cb) {\n    db.get('owner!' + name, cb);\n};\n```\n\nIn this instance `data.js` has multiple individual exports but argument binding\nalso works if you export a single function with `module.exports=` assignment.\n\nNow you can just call `sections.owners.data.one()` without supplying the `db`:\n\n``` js\nvar level = require('level');\nvar db = level('/tmp/test.db');\nvar bulk = require('bulk-require');\n\nvar sections = bulk(__dirname + '/data', [\n    [ '**/data.js', db ],\n    '**/*.js'\n]);\nsections.owners.data.one('mr-jenkins', console.log);\n```\n\n```\nnull '{\"cats\":5,\"dogs\":3}'\n```\n\n# warning\n\nFor applications full of real-world trade-offs and messy business logic\norganized into `model/` and `view/` directories  this approach to loading\nmodules may be justified, but most of the time you should just use the regular\nkind of require.\n\nWhat you should absolutely never do is run this module from somewhere deep in\nyour codebase. It should be very close to the entry point of your application.\n\nSometimes it's OK to break the rules. Especially if you can get away with it.\nCaveat npmtor.\n\n# methods\n\n``` js\nvar bulk = require('bulk-require')\n```\n\n## var modules = bulk(basedir, globs, opts={})\n\nReturn a nested object `modules` by expanding the string or array of strings\n`globs` rooted at the directory `basedir`.\n\nEach file will be placed into the nested tree `modules` based on its filename\nwith respect to `basedir`. Each directory becomes a new nested object.\n\nFor each item in the `globs` array, if the item itself is an array, the glob\nstring will be treated as the first argument and the extra arguments will be\nbound to all the top-level function exports for files matching the glob pattern.\n\nIf there is an `index.js` module that exports a single function with\n`module.exports=`, all the sub-modules will be attached to the index reference\nand it will serve as the parent node at that tree level. \n\nYou can optionally pass in a custom `require` function with `opts.require`.\n\n# install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install bulk-require\n```\n\n# license\n\nMIT\n","maintainers":[{"email":"gmaclennan@digital-democracy.org","name":"gmaclennan"}],"time":{"modified":"2022-11-11T06:33:39.210Z","created":"2014-01-11T06:37:04.728Z","0.0.0":"2014-01-11T06:37:04.728Z","0.0.1":"2014-01-11T06:47:51.303Z","0.1.0":"2014-01-11T22:13:55.326Z","0.2.0":"2014-04-21T09:52:07.453Z","0.2.1":"2014-06-10T18:25:47.787Z","1.0.0":"2016-06-22T22:23:36.235Z","1.0.1":"2017-07-18T21:13:24.762Z"},"homepage":"https://github.com/substack/bulk-require","keywords":["require","bulk","directory","glob","load","include"],"repository":{"type":"git","url":"git://github.com/substack/bulk-require.git"},"author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"bugs":{"url":"https://github.com/substack/bulk-require/issues"},"license":"MIT","readmeFilename":"readme.markdown","users":{"knownasilya":true,"koulmomo":true,"dantman":true,"shriek":true,"thevikingcoder":true}}