{"_id":"namespace","_rev":"11-6ec851733ec08c37554082f768a71ec3","name":"namespace","description":"Library for defining namespaced properties.","dist-tags":{"latest":"1.0.0"},"versions":{"0.0.1":{"name":"namespace","version":"0.0.1","description":"Library for defining namespaced properties.","keywords":["namespace","privates"],"author":{"name":"Irakli Gozalishvili","email":"rfobic@gmail.com"},"repository":{"type":"git","url":"git://github.com/Gozala/namespace.git","web":"https://github.com/Gozala/namespace"},"bugs":{"url":"http://github.com/Gozala/namespace/issues/"},"directories":{"doc":"./docs","lib":"./lib","test":"./test"},"devDependencies":{"test":">=0.0.10"},"main":"./lib/namespace.js","engines":{"node":"0.4.x","teleport":">=0.2.0"},"scripts":{"test":"node test/test-namespace.js"},"licenses":[{"type":"MPL 1.1/LGPL 2.1/GPL 2.0","url":"http://www.mozilla.org/MPL/"}],"_id":"namespace@0.0.1","_engineSupported":true,"_npmVersion":"0.3.15","_nodeVersion":"v0.4.5","files":[""],"_defaultsLoaded":true,"dist":{"shasum":"ddd3351ad5bf07263e13b665c571a13da8f2bc03","tarball":"https://registry.npmjs.org/namespace/-/namespace-0.0.1.tgz","integrity":"sha512-znFBiL3F8cjtFuKzjziHvzsjiEGmdEkLC5U1QY89dUgx3V9LdrYlVuQbxL4kk6aS4PsePhsKSWWncXySOLu9Dg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCa/XIF7lGRyG7jp/NGm6Xmzoic03nnaXbfeuAgWgh9+AIge7h7eRk4v9Nrld3kMuea8DgPJAFoj3+U6hSYj1+G75Q="}]}},"0.0.2":{"name":"namespace","version":"0.0.2","description":"Library for defining namespaced properties.","keywords":["namespace","privates"],"author":{"name":"Irakli Gozalishvili","email":"rfobic@gmail.com"},"repository":{"type":"git","url":"git://github.com/Gozala/namespace.git","web":"https://github.com/Gozala/namespace"},"bugs":{"url":"http://github.com/Gozala/namespace/issues/"},"directories":{"doc":"./docs","lib":"./lib","test":"./test"},"devDependencies":{"test":">=0.0.10"},"main":"./lib/namespace.js","engines":{"node":"0.4.x","teleport":">=0.2.0"},"scripts":{"test":"node test/test-namespace.js"},"licenses":[{"type":"MPL 1.1/LGPL 2.1/GPL 2.0","url":"http://www.mozilla.org/MPL/"}],"_id":"namespace@0.0.2","_engineSupported":true,"_npmVersion":"0.3.15","_nodeVersion":"v0.4.5","files":[""],"_defaultsLoaded":true,"dist":{"shasum":"9e0bfce0825aed337e10d9cd797592240c4f6a56","tarball":"https://registry.npmjs.org/namespace/-/namespace-0.0.2.tgz","integrity":"sha512-95RveMjNaAP8lCgiWaaPcAXE9kEWRKztMYYJlCuyVGk5HD7QUwv+UFRE+pNmBiVkgJi0uhwFGStR3+Ll8UbJHw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDWkY6SMJ8ZKCyfQ7tghuuxkISLqf//uKBq/SWvGu2IXwIgN+Ce7618HPh5OXCmkYqp76qp7f+D2lNlf+ZjHyYmVU0="}]}},"0.1.0":{"name":"namespace","id":"namespace","version":"0.1.0","description":"Library for defining namespaced properties.","keywords":["namespace","privates"],"author":{"name":"Irakli Gozalishvili","email":"rfobic@gmail.com","url":"http://jeditoolkit.com"},"repository":{"type":"git","url":"git://github.com/Gozala/namespace.git","web":"https://github.com/Gozala/namespace"},"bugs":{"url":"http://github.com/Gozala/namespace/issues/"},"devDependencies":{"test":">=0.0.10"},"main":"./namespace.js","engines":{"node":"0.4.x"},"scripts":{"test":"node test/test-namespace.js"},"licenses":[{"type":"MIT","url":"http://jeditoolkit.com/LICENSE"}],"_id":"namespace@0.1.0","dependencies":{},"_engineSupported":false,"_npmVersion":"1.0.8","_nodeVersion":"v0.5.0-pre","_defaultsLoaded":true,"dist":{"shasum":"80529c3619da518536e203a7f29496470dac09d2","tarball":"https://registry.npmjs.org/namespace/-/namespace-0.1.0.tgz","integrity":"sha512-V7ioKiyiWs/0ISKCCdX9Dia/EfQ+hc8fyWx9Zp/chMOT8jMvGWxTBzitd09hpsmyWXoXdnCzw1rJybWryu/TCQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCk5CCgBJi4nITmpPsE0n2tx4UGR/NI3nLYOGornHndjQIgQMM9J0XgIBrNbJHzA2noDjQpfh96ctd4N2Ie5+/Jogg="}]}},"1.0.0":{"name":"namespace","id":"namespace","version":"1.0.0","description":"Library for defining namespaced properties.","keywords":["namespace","privates"],"author":{"name":"Irakli Gozalishvili","email":"rfobic@gmail.com","url":"http://jeditoolkit.com"},"repository":{"type":"git","url":"git://github.com/Gozala/namespace.git","web":"https://github.com/Gozala/namespace"},"bugs":{"url":"http://github.com/Gozala/namespace/issues/"},"devDependencies":{"test":">=0.2.1","repl-utils":">=1.0.3","swank-js":">=0.0.3"},"scripts":{"test":"node test/test-all.js && node --harmony_weakmaps test/test-all.js","repl":"node --harmony_weakmaps node_modules/repl-utils","swank":"node --harmony_weakmaps node_modules/swank-js"},"licenses":[{"type":"MIT","url":"http://jeditoolkit.com/LICENSE"}],"_npmUser":{"name":"gozala","email":"rfobic@gmail.com"},"_id":"namespace@1.0.0","dependencies":{},"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.12","_nodeVersion":"v0.6.14","_defaultsLoaded":true,"dist":{"shasum":"eb2e2a438d2b30932b292a6bcfecd19af5066016","tarball":"https://registry.npmjs.org/namespace/-/namespace-1.0.0.tgz","integrity":"sha512-XGZ6X9lxVDqs+PGF6k1V8krTGo2CpFor7QC2laBTaratG3UIJI3rbS2WpOrbXJ5yQlsCohpjz6IfkZsGLBo5xg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCCCJCkjeY81SlZPuBz8c6dJuBDDSqfnpMMJSEfQTsW1gIgBnIIWrtgL4XemZ8ySNN3qG1ism8ZYm3hpY/aUXTkEiI="}]},"readme":"# namespace\n\n[![Build Status](https://secure.travis-ci.org/Gozala/namespace.png)](http://travis-ci.org/Gozala/namespace)\n\nLibrary provides an API for creating sets of namespaced properties for any\ngiven objects (frozen or not). This effectively may be used for creating\nfields that are not part of object's public API, which is useful for hiding\ninternal details or for adding fields to an existing objects (Built-ins or not)\nwithout mutating them and there for any risks of naming conflicts.\n\n\n## Usage\n\nIt is recommended to use this library with enabled `WeakMap`s. On node that\nsimply means running it with additional flag: `node --harmony_weakmaps`. If\nweak maps are not available library will fallback to using imperfect weak map\nshim.\n\n```js\nvar ns = require('namespace/core').ns\nvar internals = ns()\n\ninternals(publicAPI).secret = secret\n```\n\nNamespace may be used with multiple objects:\n\n```js\nvar observable = ns()\n\nfunction Observable() {\n  observable(this).observers = []\n}\nObservable.prototype.observe = function(observer) {\n  observable(this).observers.push(observer)\n}\n```\n\nAlso, multiple namespaces can be used with a same object without any conflicts.\n\n```js\nvar pending = ns()\n\nfunction Eventual() {\n  Observable.call(this)\n  pending(this).realized = false\n}\nEventual.prototype = Object.create(Observable.prototype)\nEventual.prototype.realize = function realize(value) {\n  if (!pending(this).realized) {\n    obesrvable(this).observers.splice.forEach(function(observer) {\n      observer(value)\n    })\n  }\n}\n```\n\nAccess to the namespaced properties can be shared with other code by simple\nhanding a namespace function. Although doing this across modules is not\nrecommended, for example instead of sharing `pending` namespace one could share\nfollowing function instead:\n\n```js\nexports.isRealized = function isRealized(value) {\n  return pending(value).realized\n}\n```\n\nNamespaced objects create parallel inheritance chain, or more simply:\n\n```js\nvar foo = ns()\nvar ancestor = {}\n\nfoo(ancestor) === foo(Object.create(ancestor)) // => true\n```\n\nNamespaces are simply a sugar on top of ES.next [WeakMaps][] allowing you to\nassociate sets of namespaced properties to an object via weak references.\n\n## Install\n\n    npm install namespace\n\n[WeakMaps]:http://wiki.ecmascript.org/doku.php?id=harmony:weak_maps\n","maintainers":[{"name":"gozala","email":"rfobic@gmail.com"}]}},"maintainers":[{"name":"gozala","email":"rfobic@gmail.com"}],"time":{"modified":"2022-06-20T19:42:41.057Z","created":"2011-04-13T01:51:07.586Z","0.0.1":"2011-04-13T01:51:08.226Z","0.0.2":"2011-04-14T06:22:23.096Z","0.1.0":"2011-06-12T11:27:39.598Z","1.0.0":"2012-05-17T23:41:10.553Z"},"author":{"name":"Irakli Gozalishvili","email":"rfobic@gmail.com","url":"http://jeditoolkit.com"},"repository":{"type":"git","url":"git://github.com/Gozala/namespace.git","web":"https://github.com/Gozala/namespace"}}