{"_id":"meta-objects","_rev":"41-5f26746cc5a775a8b8337b78793138f6","name":"meta-objects","description":"Utilities and patterns for using Harmony Proxies to meta-program. Proxies as Proxy handlers, catch all forwarders for catch all forwarders, intercession introspection. Now you're thinking with portals.","dist-tags":{"latest":"0.2.7"},"versions":{"0.0.1":{"author":{"name":"Brandon Benvie","email":"brandon@bbenvie.com","url":"http://bbenvie.com"},"name":"meta-objects","description":"Utilities and patterns for using Harmony Proxies to meta-program. Proxies as Proxy handlers, catch all forwarders for catch all forwarders, intercession introspection. Now you're thinking with portals.","version":"0.0.1","repository":{"url":"https://github.com/Benvie/meta-objects"},"main":"./lib/index.js","engines":{"node":">=0.6"},"dependencies":{},"devDependencies":{},"_npmUser":{"name":"benvie","email":"brandon@bbenvie.com"},"_id":"meta-objects@0.0.1","_engineSupported":true,"_npmVersion":"1.0.103","_nodeVersion":"v0.6.2-pre","_defaultsLoaded":true,"dist":{"shasum":"9c01bf4cd4d8a1357e9f00af13b08f8d4402665d","tarball":"https://registry.npmjs.org/meta-objects/-/meta-objects-0.0.1.tgz","integrity":"sha512-aEGSiiT6tDYJrpH4Ykg9O7U18+fq1Y4rjnVt9KSJcQC5sZY12xCoBktouxxhKpPOMJ5UFeVGNFTg8z+vE/bAgw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC5m1UN6zCHL+2t0vK7KQk0+EGEOcGpQS1fsL36rsX27wIhAOAbakcqNRP8ekqLCtZF/bECfR3yPcv++T/CRZxaQmUB"}]},"maintainers":[{"name":"benvie","email":"brandon@bbenvie.com"}]},"0.0.7":{"author":{"name":"Brandon Benvie","email":"brandon@bbenvie.com","url":"http://bbenvie.com"},"name":"meta-objects","description":"Utilities and patterns for using Harmony Proxies to meta-program. Proxies as Proxy handlers, catch all forwarders for catch all forwarders, intercession introspection. Now you're thinking with portals.","version":"0.0.7","repository":{"url":"https://github.com/Benvie/meta-objects"},"main":"./index.js","engines":{"node":">=0.6.6"},"dependencies":{"direct-proxies":"0.0.1","harmony-collections":"0.1.2"},"devDependencies":{},"_npmUser":{"name":"benvie","email":"brandon@bbenvie.com"},"_id":"meta-objects@0.0.7","_engineSupported":true,"_npmVersion":"1.1.0-beta-4","_nodeVersion":"v0.7.0-pre","_defaultsLoaded":true,"dist":{"shasum":"198026739e26855ebcbbc3c5beb58e3d64cb0793","tarball":"https://registry.npmjs.org/meta-objects/-/meta-objects-0.0.7.tgz","integrity":"sha512-eXQYev/b953aY65AlHvUYTI/g+xr5MmfO3mwCgPkXhD+NHW2qzjl8+OyKVYhSq6dMyL9lXVKTErTjW6CK/ZmwA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHtFJlNOyvdy649ZT7doysD6DvJe46uGzYYSrBpcwoT3AiEAo1JT7AZw6nKaJj89r6YBXmkx0brIKIYgsZ7o3Godgb4="}]},"readme":"# meta-objects\n\nThis repo is in flux now due to the new revision of the Proxy API approved at the end of november. Direct Proxies make most of the work previously in this repo very easy to do. The API is much easier to work with.\n\n# Basic Usage\n\nAt first only one function is exposed. This function bootstraps a few shims onto the context without which the rest wouldn't work. This function will return the actual module once you run it.\n\n    var meta = require('meta-objects')();\n\n\n# Direct Proxy Shim for both Node and Spidermonkey/Firefox\n\nThanks to the hard work of @tvcutsem in both producing the API to begin with along with a shim to provide the functionality on top of existing Proxy functionality, we can start working with the API before browsers implement it. I've created a minimal wrapper around it for use as a node module. All of the work going forward will be based on this API rather than the old one. For now I'm just copying over the README that I created for that repo until I have more substantial additions.\n\nI've also made some tenative changes that go against the new API but mostly in order to shim in behavior similar to what will eventually be done natively. There's also a couple questionable changes made to do things like allow configurable names on Functions, allow nearly genuine Array proxies, and a few other questionable things.\n\n\nhttps://github.com/Benvie/Direct-Proxies-Shim-for-Node\n\n\n\nBetond that it's also currently using WeakMaps and Maps. Maps are implemented in the latest versions of V8 but I don't think are available in Spidermonkey yet. Maps are very similar to WeakMaps but allow for primitive keys so are useful when combined with WeakMaps for storing sets of unknown properties.\n\nI have implemented what's available for the Harmony Collections API and then some extra as a shim that works in any JS environment. Alternatively, uses of Map can probably be replaced with WeakMaps in most cases if you additional checking on the inputs.\n\nhttps://github.com/Benvie/ES6-Harmony-Collections-Shim\n\n\n# Current Exposed Feature Set\nDocumentation for this will a lot of time. Many of these are simple\nfunctions, but the Proxy based APIs have a lot of depth to them\n\n    { Dispatcher: [Function: Dispatcher],\n      Trace:\n      { tracer: [Function: tracer],\n        traceDispatcher: [Function: traceDispatcher] },\n      Partials: { [Function: FactoryFactory] ___: ___, $$$: $$$ },\n      Function:\n      { [Function: create],\n        callbind: [Function],\n        applybind: [Function],\n        callapplybind: [Function: callapplybind],\n        bindcallapply: [Function: bindcallapply],\n        partial: [Function: partialbind],\n        source: [Function],\n        params: [Function: params],\n        noop: [Function: noop],\n        noopmap: [Function: noopmap] },\n      Array:\n      { [Function: create],\n        argjoin: [Function: argjoin],\n        clone: [Function: clone],\n        pushall: [Function: pushall],\n        reverse: [Function],\n        slice: [Function: slice],\n        unique: [Function: unique],\n        unzip: [Function: unzip],\n        zip: [Function: zip],\n        zipwith: [Function: zipwith] },\n      Object:\n      { [Function: create],\n        class: [Function: class],\n        clone: [Function: clone],\n        define: [Function: define],\n        defines: [Function: defines],\n        desc: [Function: desc],\n        descs: [Function: descs],\n        hasOwn: [Function: hasOwn],\n        is: [Function: is],\n        isArgs: [Function: isArguments],\n        isDescriptor: [Function: isDescriptor],\n        isPrimitive: [Function: isPrimitive],\n        keys: [Function: keys],\n        map: [Function: map],\n        names: [Function: names],\n        proto: [Function: proto] },\n      String:\n      { [Function: create],\n        explode: [Function: explode],\n        implode: [Function: implode],\n        indent: [Function],\n        repeat: [Function: repeat],\n        replace: [Function: replace],\n        reverse: [Function: reverse],\n        strmap: [Function: strmap],\n        trim: [Function: trim] },\n      Descriptors: { getter: [Function], val: [Function], pfunc: [Function] },\n      Reflectable:\n      { getOwnPropertyDescriptor: [Function],\n        getOwnPropertyNames: [Function],\n        defineProperty: [Function],\n        delete: [Function],\n        freeze: [Function],\n        seal: [Function],\n        preventExtensions: [Function],\n        has: [Function],\n        hasOwn: [Function],\n        get: [Function],\n        set: [Function],\n        enumerate: [Function],\n        iterate: [Function],\n        keys: [Function],\n        apply: [Function],\n        new: [Function],\n        VirtualHandler: [Function] },\n      WrapMap: [Function: WrapMap],\n      WeakMapSet: [Function: WeakMapSet] }\n\n\n\n\n\n\n# Partials - Using meta objects for partial function factories\n\n\n\n```javascript\n\nvar metaobjects = require('../lib')();\n    var Factory = metaobjects.Partials;\n\n\n\nvar sliceFactory = Factory(Array.prototype.slice);\n\nsliceFactory.$this = Factory.$$$;\nconsole.log(sliceFactory+'')\n/* fake sources generated by the factory for factory.toString()\n   The source is not actually run and the actual internal operation\n   runs differently than this code, but it achieves the same end result */\n//->\n      function slice_factory($0){\n        return (function slice_partial($1){\n          return (function slice(){\n          [native code]\n          }).call($0 || $1 || this);\n        });\n      }\n\n\nvar slicepartial = sliceFactory();\nconsole.log(slicepartial([1, 2, 3], 2))\n      // [ 3 ]\n\n// `new` create a clone snapshot of the factory but they don't share state after\n\nvar factory2 = new sliceFactory\n\nfactory2.$this = Factory.$$$;\nfactory2.$0 = 1;\n\nvar partial2 = factory2();\nconsole.log(partial2([1, 2, 3]))\n      // [ 2, 3 ]\n\n\n\n\nfunction someFn(someArgs, itWillRead, andUse){\n  if (typeof someArgs === 'function') {\n     var val = someArgs(this.someProperty, \"whatever\");\n  }\n  return itWillRead() ? val : andUse;\n}\n\nvar someFnFactory = Factory(someFn);\nconsole.log(someFnFactory)\n// ->\n      { [Function: someFn_factory]\n         someArgs: null,\n         itWillRead: null,\n         andUse: null }\n\nsomeFnFactory.someArgs = Array;\nsomeFnFactory.$this = { someProperty: \"yeah\" };\nsomeFnFactory.itWillRead = Factory.___;\nsomeFnFactory.andUse = Factory.___\n\nconsole.log(someFnFactory)\n//->\n      { [Function: someFn_factory]\n        someArgs: [Constructor: Array],\n        itWillRead: ___,\n        andUse: ___ }\n\nconsole.log(someFnFactory+'')\n//->\n      function someFn_factory(){\n        var someArgs = this.someArgs;\n        var $this = this.$this;\n        return (function someFn_partial(itWillRead, andUse){\n          return (function someFn(someArgs, itWillRead, andUse){\n           if (typeof someArgs === 'function') {\n              var val = someArgs(this.someProperty, \"whatever\");\n           }\n           return itWillRead() ? val : andUse;\n          }).call($this, someArgs, itWillRead, andUse);\n        });\n      }\n\n\nvar somePartial = someFnFactory();\n// copying it before we do anything to it\nvar copied = new somePartial;\n\nconsole.log(somePartial+'')\n//matchs above inner function ->\n     function someFn_partial(itWillRead, andUse){\n       return (function someFn(someArgs, itWillRead, andUse){\n        if (typeof someArgs === 'function') {\n           var val = someArgs(this.someProperty, \"whatever\");\n        }\n        return itWillRead() ? val : andUse;\n       }).call($this, someArgs, itWillRead, andUse);\n     }\n\n\n\nconsole.log(somePartial)\n//->\n      { [Function: someFn_partial]\n        someArgs: [Constructor: Array],\n        itWillRead: ___,\n        andUse: ___ }\n\n\nconsole.log(somePartial(Date, 1337));\n//     [ \"yeah\", \"whatever\" ]\n\nconsole.log(somePartial)\n//->\n      { [Function: someFn_partial],\n        someArgs: [Constructor: Array],\n        itWillRead: [Constructor: Date],\n        andUse: 1337 }\n\n\n\n// still matches the pre-call values, no shared state\nconsole.log(copied)\n```\n\n\n\n\n\n\n# Direct Proxies API Shim for Node\n\nThis module contains a very minimal amount changes to the reference implementation of the\nnew Direct Proxies API that replaces the old Harmony Proxy proposal as of December 2011.\n\nThe reference source is available here and is, as of now, being updated frequently: [es-lab DirectProxies.js](http://code.google.com/p/es-lab/source/browse/trunk/src/proxies/DirectProxies.js)\n\nThe reference test source is here: [es-lab testDirectProxies.js](http://code.google.com/p/es-lab/source/browse/trunk/src/proxies/testDirectProxies.js)\n\nThe official documentation and API is here: [ES Wiki - Direct Proxies](http://wiki.ecmascript.org/doku.php?id=harmony:direct_proxies)\n\n\n# Changes from the reference source\n\nChanges have been made for two reasons. First, to be able to load it as a module as needed\nwith an optional context to load it onto. Second, to force returned descriptors to be\nconfigurable to prevent constant errors from being thrown. The new API added support for\nnon-configurable properties on Proxies but this isn't implemented in V8 yet and it causes\nthe new API to be completely unusable instead of mostly usable if you know what you're doing.\nA better way to handle these properties could probably be implemented but the goal for this\nwas the bare minimum changes to make it usable.\n\n\n# Usage\n\n```javascript\n// initialize on context\nrequire('direct-proxies')(global); // some context, `global` is default\n\n\n// `Proxy` itself is now the creator for all proxies\nvar proxy = Proxy(target, handler);\n\n\n// all traps now have their first parameter as `target` referencing the real object\n{ getOwnPropertyDescriptor: function(target,name) }\n\n\n// new global `Reflect` contains default traps\nglobal.Reflect:\n { getOwnPropertyDescriptor,  // non-own `getProperty[Names|Descriptor]` gone\n   getOwnPropertyNames,\n   defineProperty,\n   delete,\n   freeze,                    // freeze/seal/preventExtensions separated\n   seal,\n   preventExtensions,\n   has,\n   hasOwn,\n   get,\n   set,\n   enumerate,\n   iterate,\n   keys,\n   apply,                     // apply/new are now traps on the handler\n   new }\n\n\n// for virtualized objects you can use this for your handler.prototype\n// it implements some handlers but requires the others, like old fundamental traps\nglobal.Reflect.VirtualHandler.prototype\n abstract { getOwnPropertyDescriptor,\n abstract   getOwnPropertyNames,\n abstract   defineProperty,\n abstract   delete,\n            freeze,\n            seal,\n abstract   preventExtensions,\n            has,\n            hasOwn,\n            get,\n            set,\n            enumerate,\n            iterate,\n            keys,\n abstract   apply,\n            new }\n```\n\n\n# Compatability\n\nNode 0.6.6 upgraded to V8 3.8 release candidate. The 3.7 branch introduced numerous important\nbug fixes to the Proxy and WeakMap implementations and is __required__ to make this work.\n\nIf you are using Node >0.6.6 and are still getting \"Illegal Access\" errors see this:\nhttps://github.com/joyent/node/pull/2109","maintainers":[{"name":"benvie","email":"brandon@bbenvie.com"}]},"0.0.8":{"author":{"name":"Brandon Benvie","email":"brandon@bbenvie.com","url":"http://bbenvie.com"},"name":"meta-objects","description":"Utilities and patterns for using Harmony Proxies to meta-program. Proxies as Proxy handlers, catch all forwarders for catch all forwarders, intercession introspection. Now you're thinking with portals.","version":"0.0.8","repository":{"url":"https://github.com/Benvie/meta-objects"},"main":"./index.js","engines":{"node":">=0.6.6"},"dependencies":{"direct-proxies":"0.0.2","harmony-collections":"0.1.2"},"devDependencies":{},"_npmUser":{"name":"benvie","email":"brandon@bbenvie.com"},"_id":"meta-objects@0.0.8","_engineSupported":true,"_npmVersion":"1.1.0-beta-4","_nodeVersion":"v0.7.0-pre","_defaultsLoaded":true,"dist":{"shasum":"3e356f1b52a57e8b48d27e787ce0cb3502e61472","tarball":"https://registry.npmjs.org/meta-objects/-/meta-objects-0.0.8.tgz","integrity":"sha512-hHQsl3iy+78sHTWfxirK1k1oWTjV22Kbj0HKjmKqRbf9jjYQqwhP3ZeDgTo1wPVfvfECh265fLuIojj378n03Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC6xYVdq/p9YSz/NsnSKDYkSFZdEHdUXFVu+2tvInpVBAiEAvr/5zE24hINRDqRd2XBD2VFyep4KWNyeL4PLPPczPq4="}]},"readme":"# meta-objects\n\nThis repo is in flux now due to the new revision of the Proxy API approved at the end of november. Direct Proxies make most of the work previously in this repo very easy to do. The API is much easier to work with.\n\n# Basic Usage\n\nAt first only one function is exposed. This function bootstraps a few shims onto the context without which the rest wouldn't work. This function will return the actual module once you run it.\n\n    var meta = require('meta-objects')();\n\n\n# Direct Proxy Shim for both Node and Spidermonkey/Firefox\n\nThanks to the hard work of @tvcutsem in both producing the API to begin with along with a shim to provide the functionality on top of existing Proxy functionality, we can start working with the API before browsers implement it. I've created a minimal wrapper around it for use as a node module. All of the work going forward will be based on this API rather than the old one. For now I'm just copying over the README that I created for that repo until I have more substantial additions.\n\nI've also made some tenative changes that go against the new API but mostly in order to shim in behavior similar to what will eventually be done natively. There's also a couple questionable changes made to do things like allow configurable names on Functions, allow nearly genuine Array proxies, and a few other questionable things.\n\n\nhttps://github.com/Benvie/Direct-Proxies-Shim-for-Node\n\n\n\nBetond that it's also currently using WeakMaps and Maps. Maps are implemented in the latest versions of V8 but I don't think are available in Spidermonkey yet. Maps are very similar to WeakMaps but allow for primitive keys so are useful when combined with WeakMaps for storing sets of unknown properties.\n\nI have implemented what's available for the Harmony Collections API and then some extra as a shim that works in any JS environment. Alternatively, uses of Map can probably be replaced with WeakMaps in most cases if you additional checking on the inputs.\n\nhttps://github.com/Benvie/ES6-Harmony-Collections-Shim\n\n\n# Current Exposed Feature Set\nDocumentation for this will a lot of time. Many of these are simple\nfunctions, but the Proxy based APIs have a lot of depth to them\n\n    { Dispatcher: [Function: Dispatcher],\n      Trace:\n      { tracer: [Function: tracer],\n        traceDispatcher: [Function: traceDispatcher] },\n      Partials: { [Function: FactoryFactory] ___: ___, $$$: $$$ },\n      Function:\n      { [Function: create],\n        callbind: [Function],\n        applybind: [Function],\n        callapplybind: [Function: callapplybind],\n        bindcallapply: [Function: bindcallapply],\n        partial: [Function: partialbind],\n        source: [Function],\n        params: [Function: params],\n        noop: [Function: noop],\n        noopmap: [Function: noopmap] },\n      Array:\n      { [Function: create],\n        argjoin: [Function: argjoin],\n        clone: [Function: clone],\n        pushall: [Function: pushall],\n        reverse: [Function],\n        slice: [Function: slice],\n        unique: [Function: unique],\n        unzip: [Function: unzip],\n        zip: [Function: zip],\n        zipwith: [Function: zipwith] },\n      Object:\n      { [Function: create],\n        class: [Function: class],\n        clone: [Function: clone],\n        define: [Function: define],\n        defines: [Function: defines],\n        desc: [Function: desc],\n        descs: [Function: descs],\n        hasOwn: [Function: hasOwn],\n        is: [Function: is],\n        isArgs: [Function: isArguments],\n        isDescriptor: [Function: isDescriptor],\n        isPrimitive: [Function: isPrimitive],\n        keys: [Function: keys],\n        map: [Function: map],\n        names: [Function: names],\n        proto: [Function: proto] },\n      String:\n      { [Function: create],\n        explode: [Function: explode],\n        implode: [Function: implode],\n        indent: [Function],\n        repeat: [Function: repeat],\n        replace: [Function: replace],\n        reverse: [Function: reverse],\n        strmap: [Function: strmap],\n        trim: [Function: trim] },\n      Descriptors: { getter: [Function], val: [Function], pfunc: [Function] },\n      Reflectable:\n      { getOwnPropertyDescriptor: [Function],\n        getOwnPropertyNames: [Function],\n        defineProperty: [Function],\n        delete: [Function],\n        freeze: [Function],\n        seal: [Function],\n        preventExtensions: [Function],\n        has: [Function],\n        hasOwn: [Function],\n        get: [Function],\n        set: [Function],\n        enumerate: [Function],\n        iterate: [Function],\n        keys: [Function],\n        apply: [Function],\n        new: [Function],\n        VirtualHandler: [Function] },\n      WrapMap: [Function: WrapMap],\n      WeakMapSet: [Function: WeakMapSet] }\n\n\n\n\n\n\n# Partials - Using meta objects for partial function factories\n\n\n\n```javascript\n\nvar metaobjects = require('../lib')();\n    var Factory = metaobjects.Partials;\n\n\n\nvar sliceFactory = Factory(Array.prototype.slice);\n\nsliceFactory.$this = Factory.$$$;\nconsole.log(sliceFactory+'')\n/* fake sources generated by the factory for factory.toString()\n   The source is not actually run and the actual internal operation\n   runs differently than this code, but it achieves the same end result */\n//->\n      function slice_factory($0){\n        return (function slice_partial($1){\n          return (function slice(){\n          [native code]\n          }).call($0 || $1 || this);\n        });\n      }\n\n\nvar slicepartial = sliceFactory();\nconsole.log(slicepartial([1, 2, 3], 2))\n      // [ 3 ]\n\n// `new` create a clone snapshot of the factory but they don't share state after\n\nvar factory2 = new sliceFactory\n\nfactory2.$this = Factory.$$$;\nfactory2.$0 = 1;\n\nvar partial2 = factory2();\nconsole.log(partial2([1, 2, 3]))\n      // [ 2, 3 ]\n\n\n\n\nfunction someFn(someArgs, itWillRead, andUse){\n  if (typeof someArgs === 'function') {\n     var val = someArgs(this.someProperty, \"whatever\");\n  }\n  return itWillRead() ? val : andUse;\n}\n\nvar someFnFactory = Factory(someFn);\nconsole.log(someFnFactory)\n// ->\n      { [Function: someFn_factory]\n         someArgs: null,\n         itWillRead: null,\n         andUse: null }\n\nsomeFnFactory.someArgs = Array;\nsomeFnFactory.$this = { someProperty: \"yeah\" };\nsomeFnFactory.itWillRead = Factory.___;\nsomeFnFactory.andUse = Factory.___\n\nconsole.log(someFnFactory)\n//->\n      { [Function: someFn_factory]\n        someArgs: [Constructor: Array],\n        itWillRead: ___,\n        andUse: ___ }\n\nconsole.log(someFnFactory+'')\n//->\n      function someFn_factory(){\n        var someArgs = this.someArgs;\n        var $this = this.$this;\n        return (function someFn_partial(itWillRead, andUse){\n          return (function someFn(someArgs, itWillRead, andUse){\n           if (typeof someArgs === 'function') {\n              var val = someArgs(this.someProperty, \"whatever\");\n           }\n           return itWillRead() ? val : andUse;\n          }).call($this, someArgs, itWillRead, andUse);\n        });\n      }\n\n\nvar somePartial = someFnFactory();\n// copying it before we do anything to it\nvar copied = new somePartial;\n\nconsole.log(somePartial+'')\n//matchs above inner function ->\n     function someFn_partial(itWillRead, andUse){\n       return (function someFn(someArgs, itWillRead, andUse){\n        if (typeof someArgs === 'function') {\n           var val = someArgs(this.someProperty, \"whatever\");\n        }\n        return itWillRead() ? val : andUse;\n       }).call($this, someArgs, itWillRead, andUse);\n     }\n\n\n\nconsole.log(somePartial)\n//->\n      { [Function: someFn_partial]\n        someArgs: [Constructor: Array],\n        itWillRead: ___,\n        andUse: ___ }\n\n\nconsole.log(somePartial(Date, 1337));\n//     [ \"yeah\", \"whatever\" ]\n\nconsole.log(somePartial)\n//->\n      { [Function: someFn_partial],\n        someArgs: [Constructor: Array],\n        itWillRead: [Constructor: Date],\n        andUse: 1337 }\n\n\n\n// still matches the pre-call values, no shared state\nconsole.log(copied)\n```\n\n\n\n\n\n\n# Direct Proxies API Shim for Node\n\nThis module contains a very minimal amount changes to the reference implementation of the\nnew Direct Proxies API that replaces the old Harmony Proxy proposal as of December 2011.\n\nThe reference source is available here and is, as of now, being updated frequently: [es-lab DirectProxies.js](http://code.google.com/p/es-lab/source/browse/trunk/src/proxies/DirectProxies.js)\n\nThe reference test source is here: [es-lab testDirectProxies.js](http://code.google.com/p/es-lab/source/browse/trunk/src/proxies/testDirectProxies.js)\n\nThe official documentation and API is here: [ES Wiki - Direct Proxies](http://wiki.ecmascript.org/doku.php?id=harmony:direct_proxies)\n\n\n# Changes from the reference source\n\nChanges have been made for two reasons. First, to be able to load it as a module as needed\nwith an optional context to load it onto. Second, to force returned descriptors to be\nconfigurable to prevent constant errors from being thrown. The new API added support for\nnon-configurable properties on Proxies but this isn't implemented in V8 yet and it causes\nthe new API to be completely unusable instead of mostly usable if you know what you're doing.\nA better way to handle these properties could probably be implemented but the goal for this\nwas the bare minimum changes to make it usable.\n\n\n# Usage\n\n```javascript\n// initialize on context\nrequire('direct-proxies')(global); // some context, `global` is default\n\n\n// `Proxy` itself is now the creator for all proxies\nvar proxy = Proxy(target, handler);\n\n\n// all traps now have their first parameter as `target` referencing the real object\n{ getOwnPropertyDescriptor: function(target,name) }\n\n\n// new global `Reflect` contains default traps\nglobal.Reflect:\n { getOwnPropertyDescriptor,  // non-own `getProperty[Names|Descriptor]` gone\n   getOwnPropertyNames,\n   defineProperty,\n   delete,\n   freeze,                    // freeze/seal/preventExtensions separated\n   seal,\n   preventExtensions,\n   has,\n   hasOwn,\n   get,\n   set,\n   enumerate,\n   iterate,\n   keys,\n   apply,                     // apply/new are now traps on the handler\n   new }\n\n\n// for virtualized objects you can use this for your handler.prototype\n// it implements some handlers but requires the others, like old fundamental traps\nglobal.Reflect.VirtualHandler.prototype\n abstract { getOwnPropertyDescriptor,\n abstract   getOwnPropertyNames,\n abstract   defineProperty,\n abstract   delete,\n            freeze,\n            seal,\n abstract   preventExtensions,\n            has,\n            hasOwn,\n            get,\n            set,\n            enumerate,\n            iterate,\n            keys,\n abstract   apply,\n            new }\n```\n\n\n# Compatability\n\nNode 0.6.6 upgraded to V8 3.8 release candidate. The 3.7 branch introduced numerous important\nbug fixes to the Proxy and WeakMap implementations and is __required__ to make this work.\n\nIf you are using Node >0.6.6 and are still getting \"Illegal Access\" errors see this:\nhttps://github.com/joyent/node/pull/2109","maintainers":[{"name":"benvie","email":"brandon@bbenvie.com"}]},"0.0.9":{"author":{"name":"Brandon Benvie","email":"brandon@bbenvie.com","url":"http://bbenvie.com"},"name":"meta-objects","description":"Utilities and patterns for using Harmony Proxies to meta-program. Proxies as Proxy handlers, catch all forwarders for catch all forwarders, intercession introspection. Now you're thinking with portals.","version":"0.0.9","repository":{"url":"https://github.com/Benvie/meta-objects"},"main":"./index.js","engines":{"node":">=0.6.6"},"dependencies":{"direct-proxies":"0.0.3"},"devDependencies":{},"_npmUser":{"name":"benvie","email":"brandon@bbenvie.com"},"_id":"meta-objects@0.0.9","_engineSupported":true,"_npmVersion":"1.1.0-beta-4","_nodeVersion":"v0.7.0-pre","_defaultsLoaded":true,"dist":{"shasum":"9238a9c0caa3c741ffd3f4e81625a457d628aa6c","tarball":"https://registry.npmjs.org/meta-objects/-/meta-objects-0.0.9.tgz","integrity":"sha512-oo3CLa4UUfA6Azdi5NxiSKA2/tl0tkZoFXhEQgSp1QWJclBlal1rIkYFxa4PLYXV+mf09ToBj4c80U4zUd41wg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAYxyWb/V7Uv3YJ9Ajr5rvuSSbzT8MtGyhARs4EdTRnJAiEAu7FzkpqIJnQau3Jhn0LHFdrQbpOa+triKYwEMh3LI3A="}]},"readme":"# meta-objects\n\nThis repo is in flux now due to the new revision of the Proxy API approved at the end of november. Direct Proxies make most of the work previously in this repo very easy to do. The API is much easier to work with.\n\n# Basic Usage\n\nAt first only one function is exposed. This function bootstraps a few shims onto the context without which the rest wouldn't work. This function will return the actual module once you run it.\n\n    var meta = require('meta-objects')();\n\n\n# Direct Proxy Shim for both Node and Spidermonkey/Firefox\n\nThanks to the hard work of @tvcutsem in both producing the API to begin with along with a shim to provide the functionality on top of existing Proxy functionality, we can start working with the API before browsers implement it. I've created a minimal wrapper around it for use as a node module. All of the work going forward will be based on this API rather than the old one. For now I'm just copying over the README that I created for that repo until I have more substantial additions.\n\nI've also made some tenative changes that go against the new API but mostly in order to shim in behavior similar to what will eventually be done natively. There's also a couple questionable changes made to do things like allow configurable names on Functions, allow nearly genuine Array proxies, and a few other questionable things.\n\n\nhttps://github.com/Benvie/Direct-Proxies-Shim-for-Node\n\n\n\nBetond that it's also currently using WeakMaps and Maps. Maps are implemented in the latest versions of V8 but I don't think are available in Spidermonkey yet. Maps are very similar to WeakMaps but allow for primitive keys so are useful when combined with WeakMaps for storing sets of unknown properties.\n\nI have implemented what's available for the Harmony Collections API and then some extra as a shim that works in any JS environment. Alternatively, uses of Map can probably be replaced with WeakMaps in most cases if you additional checking on the inputs.\n\nhttps://github.com/Benvie/ES6-Harmony-Collections-Shim\n\n\n# Current Exposed Feature Set\nDocumentation for this will a lot of time. Many of these are simple\nfunctions, but the Proxy based APIs have a lot of depth to them\n\n    { Function:\n      { [Function: Function],\n        noop: [Function: noop],\n        codeToParts: [Function: codeToParts],\n        partsToCode: [Function: partsToCode],\n        callbind: [Function: callbind],\n        applybind: [Function: applybind] },\n      Object:\n      { [Function: create],\n        define: [Function: defineProperty],\n        defines: [Function: defines],\n        desc: [Function: desc],\n        names: [Function: getOwnPropertyNames],\n        proto: [Function: proto],\n        keys: [Function: keys],\n        hasOwn: [Function: hasOwn],\n        toClass: [Function: toClass],\n        descs: [Function: descs],\n        clone: [Function: clone],\n        unzip: [Function: unzip],\n        map: [Function: map] },\n      Descriptor:\n      { [Function: Descriptor],\n        getter: [Function: getter],\n        val: [Function: val],\n        pfunc: [Function: pfunc] },\n      is:\n      { [Function: is],\n        Primitive: [Function: isPrimitive],\n        Descriptor: [Function: isDescriptor],\n        Array: [Function: isArray],\n        Arguments: [Function: isArguments] },\n      String:\n      { char: [Function: char],\n        charcode: [Function: charcode],\n        concat: [Function: concat],\n        fixed: [Function: fixed],\n        idx: [Function: idx],\n        idxR: [Function: idxR],\n        lcompare: [Function: lcompare],\n        match: [Function: match],\n        replace: [Function: replace],\n        search: [Function: search],\n        slice: [Function: slice],\n        split: [Function: split],\n        substr: [Function: substr],\n        substring: [Function: substring],\n        lcaseL: [Function: lcaseL],\n        lcaseU: [Function: lcaseU],\n        caseL: [Function: caseL],\n        caseU: [Function: caseU],\n        trim: [Function: trim],\n        trimL: [Function: trimL],\n        trimR: [Function: trimR],\n        repeat: [Function: repeat] },\n      Array:\n      { concat: [Function: concat],\n        every: [Function: every],\n        filter: [Function: filter],\n        each: [Function: each],\n        idx: [Function: idx],\n        join: [Function: join],\n        idxR: [Function: idxR],\n        map: [Function: map],\n        pop: [Function: pop],\n        push: [Function: push],\n        reduce: [Function: reduce],\n        reduceR: [Function: reduceR],\n        reverse: [Function: reverse],\n        shift: [Function: shift],\n        slice: [Function: slice],\n        some: [Function: some],\n        sort: [Function: sort],\n        splice: [Function: splice],\n        unshift: [Function: unshift],\n        pushall: [Function: pushall],\n        flatten: [Function: flatten],\n        zipwith: [Function: zipwith],\n        unique: [Function: unique],\n        zip: [Function: zip] },\n      WrapMap: [Function: WrapMap],\n      WeakMapSet: [Function: WeakMapSet],\n      Reflectable:\n      { VirtualHandler: [Function],\n        defineProperty: [Function],\n        delete: [Function],\n        enumerate: [Function],\n        freeze: [Function],\n        get: [Function],\n        getOwnPropertyDescriptor: [Function],\n        getOwnPropertyNames: [Function],\n        has: [Function],\n        hasOwn: [Function],\n        iterate: [Function],\n        keys: [Function],\n        new: [Function],\n        preventExtensions: [Function],\n        seal: [Function],\n        set: [Function] },\n      Traps:\n      { getOwnPropertyDescriptor: [ \"target\", \"name\" ],\n        getOwnPropertyNames: [ \"target\" ],\n        defineProperty: [ \"target\", \"name\", \"descriptor\" ],\n        preventExtensions: [ \"target\" ],\n        freeze: [ \"target\" ],\n        seal: [ \"target\" ],\n        delete: [ \"target\", \"name\" ],\n        hasOwn: [ \"target\", \"name\" ],\n        has: [ \"target\", \"name\" ],\n        get: [ \"target\", \"name\", \"receiver\" ],\n        set: [ \"target\", \"name\", \"value\", \"receiver\" ],\n        enumerate: [ \"target\" ],\n        iterate: [ \"target\" ],\n        keys: [ \"target\" ],\n        apply: [ \"target\", \"receiver\", \"args\" ],\n        new: [ \"target\", \"args\" ] } }\n\n\n\n\n\n# Partials - Using meta objects for partial function factories\n\n\n\n```javascript\n\nvar metaobjects = require('../lib')();\n    var Factory = metaobjects.Partials;\n\n\n\nvar sliceFactory = Factory(Array.prototype.slice);\n\nsliceFactory.$this = Factory.$$$;\nconsole.log(sliceFactory+'')\n/* fake sources generated by the factory for factory.toString()\n   The source is not actually run and the actual internal operation\n   runs differently than this code, but it achieves the same end result */\n//->\n      function slice_factory($0){\n        return (function slice_partial($1){\n          return (function slice(){\n          [native code]\n          }).call($0 || $1 || this);\n        });\n      }\n\n\nvar slicepartial = sliceFactory();\nconsole.log(slicepartial([1, 2, 3], 2))\n      // [ 3 ]\n\n// `new` create a clone snapshot of the factory but they don't share state after\n\nvar factory2 = new sliceFactory\n\nfactory2.$this = Factory.$$$;\nfactory2.$0 = 1;\n\nvar partial2 = factory2();\nconsole.log(partial2([1, 2, 3]))\n      // [ 2, 3 ]\n\n\n\n\nfunction someFn(someArgs, itWillRead, andUse){\n  if (typeof someArgs === 'function') {\n     var val = someArgs(this.someProperty, \"whatever\");\n  }\n  return itWillRead() ? val : andUse;\n}\n\nvar someFnFactory = Factory(someFn);\nconsole.log(someFnFactory)\n// ->\n      { [Function: someFn_factory]\n         someArgs: null,\n         itWillRead: null,\n         andUse: null }\n\nsomeFnFactory.someArgs = Array;\nsomeFnFactory.$this = { someProperty: \"yeah\" };\nsomeFnFactory.itWillRead = Factory.___;\nsomeFnFactory.andUse = Factory.___\n\nconsole.log(someFnFactory)\n//->\n      { [Function: someFn_factory]\n        someArgs: [Constructor: Array],\n        itWillRead: ___,\n        andUse: ___ }\n\nconsole.log(someFnFactory+'')\n//->\n      function someFn_factory(){\n        var someArgs = this.someArgs;\n        var $this = this.$this;\n        return (function someFn_partial(itWillRead, andUse){\n          return (function someFn(someArgs, itWillRead, andUse){\n           if (typeof someArgs === 'function') {\n              var val = someArgs(this.someProperty, \"whatever\");\n           }\n           return itWillRead() ? val : andUse;\n          }).call($this, someArgs, itWillRead, andUse);\n        });\n      }\n\n\nvar somePartial = someFnFactory();\n// copying it before we do anything to it\nvar copied = new somePartial;\n\nconsole.log(somePartial+'')\n//matchs above inner function ->\n     function someFn_partial(itWillRead, andUse){\n       return (function someFn(someArgs, itWillRead, andUse){\n        if (typeof someArgs === 'function') {\n           var val = someArgs(this.someProperty, \"whatever\");\n        }\n        return itWillRead() ? val : andUse;\n       }).call($this, someArgs, itWillRead, andUse);\n     }\n\n\n\nconsole.log(somePartial)\n//->\n      { [Function: someFn_partial]\n        someArgs: [Constructor: Array],\n        itWillRead: ___,\n        andUse: ___ }\n\n\nconsole.log(somePartial(Date, 1337));\n//     [ \"yeah\", \"whatever\" ]\n\nconsole.log(somePartial)\n//->\n      { [Function: someFn_partial],\n        someArgs: [Constructor: Array],\n        itWillRead: [Constructor: Date],\n        andUse: 1337 }\n\n\n\n// still matches the pre-call values, no shared state\nconsole.log(copied)\n```\n\n\n\n\n\n\n# Direct Proxies API Shim for Node\n\nThis module contains a very minimal amount changes to the reference implementation of the\nnew Direct Proxies API that replaces the old Harmony Proxy proposal as of December 2011.\n\nThe reference source is available here and is, as of now, being updated frequently: [es-lab DirectProxies.js](http://code.google.com/p/es-lab/source/browse/trunk/src/proxies/DirectProxies.js)\n\nThe reference test source is here: [es-lab testDirectProxies.js](http://code.google.com/p/es-lab/source/browse/trunk/src/proxies/testDirectProxies.js)\n\nThe official documentation and API is here: [ES Wiki - Direct Proxies](http://wiki.ecmascript.org/doku.php?id=harmony:direct_proxies)\n\n\n# Changes from the reference source\n\nChanges have been made for two reasons. First, to be able to load it as a module as needed\nwith an optional context to load it onto. Second, to force returned descriptors to be\nconfigurable to prevent constant errors from being thrown. The new API added support for\nnon-configurable properties on Proxies but this isn't implemented in V8 yet and it causes\nthe new API to be completely unusable instead of mostly usable if you know what you're doing.\nA better way to handle these properties could probably be implemented but the goal for this\nwas the bare minimum changes to make it usable.\n\n\n# Usage\n\n```javascript\n// initialize on context\nrequire('direct-proxies')(global); // some context, `global` is default\n\n\n// `Proxy` itself is now the creator for all proxies\nvar proxy = Proxy(target, handler);\n\n\n// all traps now have their first parameter as `target` referencing the real object\n{ getOwnPropertyDescriptor: function(target,name) }\n\n\n// new global `Reflect` contains default traps\nglobal.Reflect:\n { getOwnPropertyDescriptor,  // non-own `getProperty[Names|Descriptor]` gone\n   getOwnPropertyNames,\n   defineProperty,\n   delete,\n   freeze,                    // freeze/seal/preventExtensions separated\n   seal,\n   preventExtensions,\n   has,\n   hasOwn,\n   get,\n   set,\n   enumerate,\n   iterate,\n   keys,\n   apply,                     // apply/new are now traps on the handler\n   new }\n\n\n// for virtualized objects you can use this for your handler.prototype\n// it implements some handlers but requires the others, like old fundamental traps\nglobal.Reflect.VirtualHandler.prototype\n abstract { getOwnPropertyDescriptor,\n abstract   getOwnPropertyNames,\n abstract   defineProperty,\n abstract   delete,\n            freeze,\n            seal,\n abstract   preventExtensions,\n            has,\n            hasOwn,\n            get,\n            set,\n            enumerate,\n            iterate,\n            keys,\n abstract   apply,\n            new }\n```\n\n\n# Compatability\n\nNode 0.6.6 upgraded to V8 3.8 release candidate. The 3.7 branch introduced numerous important\nbug fixes to the Proxy and WeakMap implementations and is __required__ to make this work.\n\nIf you are using Node >0.6.6 and are still getting \"Illegal Access\" errors see this:\nhttps://github.com/joyent/node/pull/2109","maintainers":[{"name":"benvie","email":"brandon@bbenvie.com"}]},"0.1.0":{"author":{"name":"Brandon Benvie","email":"brandon@bbenvie.com","url":"http://bbenvie.com"},"name":"meta-objects","description":"Utilities and patterns for using Harmony Proxies to meta-program. Proxies as Proxy handlers, catch all forwarders for catch all forwarders, intercession introspection. Now you're thinking with portals.","keywords":["harmony","proxy","meta","objects","membrane","ecmascript","function","functional","partial","weakmap","trace"],"version":"0.1.0","repository":{"url":"https://github.com/Benvie/meta-objects"},"main":"./index.js","engines":{"node":">=0.6.6"},"dependencies":{"direct-proxies":"0.0.3"},"devDependencies":{},"_npmUser":{"name":"benvie","email":"brandon@bbenvie.com"},"_id":"meta-objects@0.1.0","_engineSupported":true,"_npmVersion":"1.1.0-beta-4","_nodeVersion":"v0.7.0-pre","_defaultsLoaded":true,"dist":{"shasum":"bd402902ed11ab1a03eac437b0b0adf0b5c3563d","tarball":"https://registry.npmjs.org/meta-objects/-/meta-objects-0.1.0.tgz","integrity":"sha512-G+SsaXFbeUtFlh9hXZ2QyIERBL9Z/3cGRmm/MdKEez9Scs4uCHC42uxJkhAIryYCX16w5RmeD+cZ1vpArkRWIA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGt+f+bEfAhQEWi7nGmHQGfv9CaTGel8VoGeBjAZ71enAiAYf4GZoKE22TH5UrqbKkSqKCag8+ele/z19HLxz95E7A=="}]},"readme":"# meta-objects\n\nThis repo is in flux now due to the new revision of the Proxy API approved at the end of november. Direct Proxies make most of the work previously in this repo very easy to do. The API is much easier to work with.\n\n# Basic Usage\n\nAt first only one function is exposed. This function bootstraps a few shims onto the context without which the rest wouldn't work. This function will return the actual module once you run it.\n\n    var meta = require('meta-objects')();\n\n\n# Direct Proxy Shim for both Node and Spidermonkey/Firefox\n\nThanks to the hard work of @tvcutsem in both producing the API to begin with along with a shim to provide the functionality on top of existing Proxy functionality, we can start working with the API before browsers implement it. I've created a minimal wrapper around it for use as a node module. All of the work going forward will be based on this API rather than the old one. For now I'm just copying over the README that I created for that repo until I have more substantial additions.\n\nI've also made some tenative changes that go against the new API but mostly in order to shim in behavior similar to what will eventually be done natively. There's also a couple questionable changes made to do things like allow configurable names on Functions, allow nearly genuine Array proxies, and a few other questionable things.\n\n\nhttps://github.com/Benvie/Direct-Proxies-Shim-for-Node\n\n\n\nBetond that it's also currently using WeakMaps and Maps. Maps are implemented in the latest versions of V8 but I don't think are available in Spidermonkey yet. Maps are very similar to WeakMaps but allow for primitive keys so are useful when combined with WeakMaps for storing sets of unknown properties.\n\nI have implemented what's available for the Harmony Collections API and then some extra as a shim that works in any JS environment. Alternatively, uses of Map can probably be replaced with WeakMaps in most cases if you additional checking on the inputs.\n\nhttps://github.com/Benvie/ES6-Harmony-Collections-Shim\n\n\n# Current Exposed Feature Set\nDocumentation for this will a lot of time. Many of these are simple\nfunctions, but the Proxy based APIs have a lot of depth to them\n\n    { Function:\n      { [Function: Function],\n        noop: [Function: noop],\n        codeToParts: [Function: codeToParts],\n        partsToCode: [Function: partsToCode],\n        callbind: [Function: callbind],\n        applybind: [Function: applybind] },\n      Object:\n      { [Function: create],\n        define: [Function: defineProperty],\n        defines: [Function: defines],\n        desc: [Function: desc],\n        names: [Function: getOwnPropertyNames],\n        proto: [Function: proto],\n        keys: [Function: keys],\n        hasOwn: [Function: hasOwn],\n        toClass: [Function: toClass],\n        descs: [Function: descs],\n        clone: [Function: clone],\n        unzip: [Function: unzip],\n        map: [Function: map] },\n      Descriptor:\n      { [Function: Descriptor],\n        getter: [Function: getter],\n        val: [Function: val],\n        pfunc: [Function: pfunc] },\n      is:\n      { [Function: is],\n        Primitive: [Function: isPrimitive],\n        Descriptor: [Function: isDescriptor],\n        Array: [Function: isArray],\n        Arguments: [Function: isArguments] },\n      String:\n      { char: [Function: char],\n        charcode: [Function: charcode],\n        concat: [Function: concat],\n        fixed: [Function: fixed],\n        idx: [Function: idx],\n        idxR: [Function: idxR],\n        lcompare: [Function: lcompare],\n        match: [Function: match],\n        replace: [Function: replace],\n        search: [Function: search],\n        slice: [Function: slice],\n        split: [Function: split],\n        substr: [Function: substr],\n        substring: [Function: substring],\n        lcaseL: [Function: lcaseL],\n        lcaseU: [Function: lcaseU],\n        caseL: [Function: caseL],\n        caseU: [Function: caseU],\n        trim: [Function: trim],\n        trimL: [Function: trimL],\n        trimR: [Function: trimR],\n        repeat: [Function: repeat] },\n      Array:\n      { concat: [Function: concat],\n        every: [Function: every],\n        filter: [Function: filter],\n        each: [Function: each],\n        idx: [Function: idx],\n        join: [Function: join],\n        idxR: [Function: idxR],\n        map: [Function: map],\n        pop: [Function: pop],\n        push: [Function: push],\n        reduce: [Function: reduce],\n        reduceR: [Function: reduceR],\n        reverse: [Function: reverse],\n        shift: [Function: shift],\n        slice: [Function: slice],\n        some: [Function: some],\n        sort: [Function: sort],\n        splice: [Function: splice],\n        unshift: [Function: unshift],\n        pushall: [Function: pushall],\n        flatten: [Function: flatten],\n        zipwith: [Function: zipwith],\n        unique: [Function: unique],\n        zip: [Function: zip] },\n      WrapMap: [Function: WrapMap],\n      WeakMapSet: [Function: WeakMapSet],\n      Reflectable:\n      { VirtualHandler: [Function],\n        defineProperty: [Function],\n        delete: [Function],\n        enumerate: [Function],\n        freeze: [Function],\n        get: [Function],\n        getOwnPropertyDescriptor: [Function],\n        getOwnPropertyNames: [Function],\n        has: [Function],\n        hasOwn: [Function],\n        iterate: [Function],\n        keys: [Function],\n        new: [Function],\n        preventExtensions: [Function],\n        seal: [Function],\n        set: [Function] },\n      Traps:\n      { getOwnPropertyDescriptor: [ \"target\", \"name\" ],\n        getOwnPropertyNames: [ \"target\" ],\n        defineProperty: [ \"target\", \"name\", \"descriptor\" ],\n        preventExtensions: [ \"target\" ],\n        freeze: [ \"target\" ],\n        seal: [ \"target\" ],\n        delete: [ \"target\", \"name\" ],\n        hasOwn: [ \"target\", \"name\" ],\n        has: [ \"target\", \"name\" ],\n        get: [ \"target\", \"name\", \"receiver\" ],\n        set: [ \"target\", \"name\", \"value\", \"receiver\" ],\n        enumerate: [ \"target\" ],\n        iterate: [ \"target\" ],\n        keys: [ \"target\" ],\n        apply: [ \"target\", \"receiver\", \"args\" ],\n        new: [ \"target\", \"args\" ] } }\n\n\n\n\n\n# Partials - Using meta objects for partial function factories\n\n\n\n```javascript\n\nvar metaobjects = require('../lib')();\n    var Factory = metaobjects.Partials;\n\n\n\nvar sliceFactory = Factory(Array.prototype.slice);\n\nsliceFactory.$this = Factory.$$$;\nconsole.log(sliceFactory+'')\n/* fake sources generated by the factory for factory.toString()\n   The source is not actually run and the actual internal operation\n   runs differently than this code, but it achieves the same end result */\n//->\n      function slice_factory($0){\n        return (function slice_partial($1){\n          return (function slice(){\n          [native code]\n          }).call($0 || $1 || this);\n        });\n      }\n\n\nvar slicepartial = sliceFactory();\nconsole.log(slicepartial([1, 2, 3], 2))\n      // [ 3 ]\n\n// `new` create a clone snapshot of the factory but they don't share state after\n\nvar factory2 = new sliceFactory\n\nfactory2.$this = Factory.$$$;\nfactory2.$0 = 1;\n\nvar partial2 = factory2();\nconsole.log(partial2([1, 2, 3]))\n      // [ 2, 3 ]\n\n\n\n\nfunction someFn(someArgs, itWillRead, andUse){\n  if (typeof someArgs === 'function') {\n     var val = someArgs(this.someProperty, \"whatever\");\n  }\n  return itWillRead() ? val : andUse;\n}\n\nvar someFnFactory = Factory(someFn);\nconsole.log(someFnFactory)\n// ->\n      { [Function: someFn_factory]\n         someArgs: null,\n         itWillRead: null,\n         andUse: null }\n\nsomeFnFactory.someArgs = Array;\nsomeFnFactory.$this = { someProperty: \"yeah\" };\nsomeFnFactory.itWillRead = Factory.___;\nsomeFnFactory.andUse = Factory.___\n\nconsole.log(someFnFactory)\n//->\n      { [Function: someFn_factory]\n        someArgs: [Constructor: Array],\n        itWillRead: ___,\n        andUse: ___ }\n\nconsole.log(someFnFactory+'')\n//->\n      function someFn_factory(){\n        var someArgs = this.someArgs;\n        var $this = this.$this;\n        return (function someFn_partial(itWillRead, andUse){\n          return (function someFn(someArgs, itWillRead, andUse){\n           if (typeof someArgs === 'function') {\n              var val = someArgs(this.someProperty, \"whatever\");\n           }\n           return itWillRead() ? val : andUse;\n          }).call($this, someArgs, itWillRead, andUse);\n        });\n      }\n\n\nvar somePartial = someFnFactory();\n// copying it before we do anything to it\nvar copied = new somePartial;\n\nconsole.log(somePartial+'')\n//matchs above inner function ->\n     function someFn_partial(itWillRead, andUse){\n       return (function someFn(someArgs, itWillRead, andUse){\n        if (typeof someArgs === 'function') {\n           var val = someArgs(this.someProperty, \"whatever\");\n        }\n        return itWillRead() ? val : andUse;\n       }).call($this, someArgs, itWillRead, andUse);\n     }\n\n\n\nconsole.log(somePartial)\n//->\n      { [Function: someFn_partial]\n        someArgs: [Constructor: Array],\n        itWillRead: ___,\n        andUse: ___ }\n\n\nconsole.log(somePartial(Date, 1337));\n//     [ \"yeah\", \"whatever\" ]\n\nconsole.log(somePartial)\n//->\n      { [Function: someFn_partial],\n        someArgs: [Constructor: Array],\n        itWillRead: [Constructor: Date],\n        andUse: 1337 }\n\n\n\n// still matches the pre-call values, no shared state\nconsole.log(copied)\n```\n\n\n\n\n\n\n# Direct Proxies API Shim for Node\n\nThis module contains a very minimal amount changes to the reference implementation of the\nnew Direct Proxies API that replaces the old Harmony Proxy proposal as of December 2011.\n\nThe reference source is available here and is, as of now, being updated frequently: [es-lab DirectProxies.js](http://code.google.com/p/es-lab/source/browse/trunk/src/proxies/DirectProxies.js)\n\nThe reference test source is here: [es-lab testDirectProxies.js](http://code.google.com/p/es-lab/source/browse/trunk/src/proxies/testDirectProxies.js)\n\nThe official documentation and API is here: [ES Wiki - Direct Proxies](http://wiki.ecmascript.org/doku.php?id=harmony:direct_proxies)\n\n\n# Changes from the reference source\n\nChanges have been made for two reasons. First, to be able to load it as a module as needed\nwith an optional context to load it onto. Second, to force returned descriptors to be\nconfigurable to prevent constant errors from being thrown. The new API added support for\nnon-configurable properties on Proxies but this isn't implemented in V8 yet and it causes\nthe new API to be completely unusable instead of mostly usable if you know what you're doing.\nA better way to handle these properties could probably be implemented but the goal for this\nwas the bare minimum changes to make it usable.\n\n\n# Usage\n\n```javascript\n// initialize on context\nrequire('direct-proxies')(global); // some context, `global` is default\n\n\n// `Proxy` itself is now the creator for all proxies\nvar proxy = Proxy(target, handler);\n\n\n// all traps now have their first parameter as `target` referencing the real object\n{ getOwnPropertyDescriptor: function(target,name) }\n\n\n// new global `Reflect` contains default traps\nglobal.Reflect:\n { getOwnPropertyDescriptor,  // non-own `getProperty[Names|Descriptor]` gone\n   getOwnPropertyNames,\n   defineProperty,\n   delete,\n   freeze,                    // freeze/seal/preventExtensions separated\n   seal,\n   preventExtensions,\n   has,\n   hasOwn,\n   get,\n   set,\n   enumerate,\n   iterate,\n   keys,\n   apply,                     // apply/new are now traps on the handler\n   new }\n\n\n// for virtualized objects you can use this for your handler.prototype\n// it implements some handlers but requires the others, like old fundamental traps\nglobal.Reflect.VirtualHandler.prototype\n abstract { getOwnPropertyDescriptor,\n abstract   getOwnPropertyNames,\n abstract   defineProperty,\n abstract   delete,\n            freeze,\n            seal,\n abstract   preventExtensions,\n            has,\n            hasOwn,\n            get,\n            set,\n            enumerate,\n            iterate,\n            keys,\n abstract   apply,\n            new }\n```\n\n\n# Compatability\n\nNode 0.6.6 upgraded to V8 3.8 release candidate. The 3.7 branch introduced numerous important\nbug fixes to the Proxy and WeakMap implementations and is __required__ to make this work.\n\nIf you are using Node >0.6.6 and are still getting \"Illegal Access\" errors see this:\nhttps://github.com/joyent/node/pull/2109","maintainers":[{"name":"benvie","email":"brandon@bbenvie.com"}]},"0.1.2":{"author":{"name":"Brandon Benvie","email":"brandon@bbenvie.com","url":"http://bbenvie.com"},"name":"meta-objects","description":"Utilities and patterns for using Harmony Proxies to meta-program. Proxies as Proxy handlers, catch all forwarders for catch all forwarders, intercession introspection. Now you're thinking with portals.","keywords":["harmony","proxy","meta","objects","membrane","ecmascript","functional","partial","weakmap","trace"],"version":"0.1.2","repository":{"url":"https://github.com/Benvie/meta-objects"},"main":"./index.js","engines":{"node":">=0.6.6"},"dependencies":{"direct-proxies":"0.1.0"},"devDependencies":{},"_npmUser":{"name":"benvie","email":"brandon@bbenvie.com"},"_id":"meta-objects@0.1.2","_engineSupported":true,"_npmVersion":"1.1.0-beta-4","_nodeVersion":"v0.7.0-pre","_defaultsLoaded":true,"dist":{"shasum":"6e30f4c33d749c46ddbac6ce9ac7eb2a4d6cfbd6","tarball":"https://registry.npmjs.org/meta-objects/-/meta-objects-0.1.2.tgz","integrity":"sha512-wwQ1JUg4OGba91kPB2sfKW7maWUpWps72KV1aWreHNdBDlkBHHfHvl3DhbIWySW8FgVhcD1pN3k1dLSV2044HA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCn9uZza2vpCVHP04lUwW84ePRxnxQ/qqY4UTYw0CWrWgIhALrT4/VIqaQnW/LAfTeAlIL+TdwT/Pm6M1xMubTZRsC+"}]},"readme":"# meta-objects\n\nThis repo is in flux now due to the new revision of the Proxy API approved at the end of november. Direct Proxies make most of the work previously in this repo very easy to do. The API is much easier to work with.\n\n# Basic Usage\n\nAt first only one function is exposed. This function bootstraps a few shims onto the context without which the rest wouldn't work. This function will return the actual module once you run it.\n\n    var meta = require('meta-objects')();\n\n\n# Direct Proxy Shim for both Node and Spidermonkey/Firefox\n\nThanks to the hard work of [Tom Van Cutsem](https://github.com/tvcutsem) in both producing the API to begin with along with a shim to provide the functionality on top of existing Proxy functionality, we can start working with the API before browsers implement it. I've created a minimal wrapper around it for use as a node module. All of the work going forward will be based on this API rather than the old one.\n\nhttps://github.com/Benvie/Direct-Proxies-Shim-for-Node\n\n\n# Current Feature Set\n\nUpdated API. Now focusing specifically on Proxy related functionality rather than also having a lot of utilities. More docs to come.\n\n    { createPartial:     [Function: createPartial],\n      createFunction:    [Function: createFunction],\n      createDispatcher:  [Function: createDispatcher],\n      WrapMap:           [Constructor: WrapMap],\n      WeakMapSet:        [Constructor: WeakMapSet] }\n\n\n\n# Function.create\n\nNot possible to implemented without Proxies, meta-objects provides the `createFunction` function.\n\n    createFunction([name, [onCall, [onConstruct]]]);\n\nAll arguments are optional. This function enables a few unique use-cases:\n\n* Rename existing function. Provide a name and a function and the return is a function that works exactly the same, but has a different `name`, which will faithfully be shown by consoles and other debuggers.\n\n   var renamed = createFunction('someName', function(){ return arguments.callee.name });\n\n* Meld a call handler and a constructor into one. Provide two functions, one for calling and one for constructing, and they'll be represented by one single public entity, even in fn.prototype.constructor.\n\n```javascript\nfunction callHandler(){ console.log('called') }\nfunction Ctor(){ this.madeFrom = 'Ctor' }\nCtor.prototype.isWinning = true;\n\nvar myCrazyClass = createFunction('CrazyClass', callHandler, Ctor);\n\nconsole.log(myCrazyClass);\n  // -->\n    { [Constructor: CrazyClass]\n      prototype: { isWinning: true } }\n\nmyCrazyClass();\n  // --> 'called';\nnew myCrazyClass;\n  // -->\n    { madeFrom: 'Ctor',\n      [__proto__]: { isWinning: true } };\n```\n\n* Clone a function to give it a new identity without changing it in any other way. Useful for things like WeakMaps (require unique identity) or adding properties without tainting the original.\n\n    var newObjectDotCreate = createFunction(Object.create); //[Function: create]\n\n\n\n# Partials - Using meta objects for partial function factories\n\n```javascript\nvar meta = require('../lib')();\n\nvar createPartial = meta.createPartial;\nvar __   = createPartial.__;\nvar ____ = createPartial.____;\nvar $$$  = createPartial.$$$;\n\n\n\nvar sliceFactory = createPartial(Array.prototype.slice);\n\n/*\n  fake sources generated by the factory for factory.toString()\n  The source is not actually run and the actual internal operation\n  runs differently than this code, but it achieves the same end result */\n\nsliceFactory.$this = $$$;\nconsole.log(sliceFactory+'')\n  // ->\n    function slice_factory($0){\n      return (function slice_partial($1){\n        return (function slice(){\n        [native code]\n        }).call($0 || $1 || this);\n      });\n    }\n\n\nvar slicepartial = sliceFactory();\nconsole.log(slicepartial([1, 2, 3], 2))\n  // -> [ 3 ]\n\n// `new` creates a clone snapshot of the factory but they don't share state after\nvar factory2 = new sliceFactory;\nfactory2.$0 = 1;\nvar partial2 = factory2();\nconsole.log(partial2([1, 2, 3]))\n  // -> [ 2, 3 ]\n\n\n\n\nfunction someFn(someArgs, itWillRead, andUse){\n  if (typeof someArgs === 'function') {\n    var val = someArgs(this.someProperty, \"whatever\");\n  }\n  return itWillRead() ? val : andUse;\n}\n\nvar someFnFactory = createPartial(someFn);\nconsole.log(someFnFactory)\n  // ->\n    { [Function: someFn_factory]\n       someArgs:     __,\n       itWillRead:   __,\n       andUse:       __    }\n\nsomeFnFactory.someArgs = Array;\nsomeFnFactory.itWillRead = ____;\nsomeFnFactory.$this = { someProperty: \"yeah\" };\n\nconsole.log(someFnFactory)\n  // ->\n    { [Function: someFn_factory]\n      someArgs:    Array,\n      itWillRead:  ____,\n      andUse:      __     }\n\nconsole.log(someFnFactory+'')\n  // ->\n      function someFn_factory(itWillRead){\n        var someArgs = this.someArgs;\n        var $this = this.$this;\n        return (function someFn_partial(andUse){\n          return (function someFn(someArgs, itWillRead, andUse){\n            if (typeof someArgs === 'function') {\n              var val = someArgs(this.someProperty, \"whatever\");\n            }\n            return itWillRead() ? val : andUse;\n          }).call($this, someArgs, itWillRead, andUse);\n        });\n      }\n\n\n\nvar somePartial = someFnFactory(Date);\n// copying it before we do anything to it\nvar copied = new somePartial;\n\n//matches the corrsponeding inner function above\nconsole.log(somePartial+'')\n  // ->\n    function someFn_partial(andUse){\n      return (function someFn(someArgs, itWillRead, andUse){\n        if (typeof someArgs === 'function') {\n          var val = someArgs(this.someProperty, \"whatever\");\n        }\n        return itWillRead() ? val : andUse;\n      }).call($this, someArgs, itWillRead, andUse);\n    }\n\nconsole.log(somePartial)\n  // ->\n    { [Function: someFn_partial]\n      someArgs:     Array,\n      itWillRead:   Date,\n      andUse:       __     }\n\n\nconsole.log(somePartial(1337));\n  // ->\n    //[ \"yeah\", \"whatever\" ]\n\n\nconsole.log(somePartial)\n/* identity is refreshed upon fulfillment, the final call isn't saved\n  // ->\n    { [Function: someFn_partial]\n      someArgs:     Array,\n      itWillRead:   Date,\n      andUse:       __     }\n\n```\n\n# Direct Proxies Usage\n\n```javascript\n// initialize on context\nrequire('direct-proxies').shim(); // a context, `global` is default\n\n\n// `Proxy` itself is now the creator for all proxies\nvar proxy = Proxy(target, handler);\n\n\n// all traps now have their first parameter as `target` referencing the real object\n{ getOwnPropertyDescriptor: function(target, name) }\n\n\n// new global `Reflect` contains default traps\nglobal.Reflect:\n { getOwnPropertyDescriptor,  // non-own `getProperty[Names|Descriptor]` gone\n   getOwnPropertyNames,\n   defineProperty,\n   deleteProperty,            // name changed\n   freeze,                    // freeze/seal/preventExtensions separated\n   seal,\n   preventExtensions,\n   has,\n   hasOwn,\n   get,\n   set,\n   enumerate,\n   iterate,\n   keys,\n   apply,                     // apply/new are now traps on the handler\n   construct }\n\n\n// for virtualized objects you can use this for your handler.prototype\n// it implements some handlers but requires the others, like old fundamental traps\nglobal.Reflect.VirtualHandler.prototype\n abstract { getOwnPropertyDescriptor,\n abstract   getOwnPropertyNames,\n abstract   defineProperty,\n abstract   deleteProperty,\n            freeze,\n            seal,\n abstract   preventExtensions,\n            has,\n            hasOwn,\n            get,\n            set,\n            enumerate,\n            iterate,\n            keys,\n abstract   apply,\n            construct }\n```\n\n\n# Compatability\n\nThe current stable Node.js branch, 0.6.x, uses a version of V8 with bugs that makes it incompatible with this shim. Node's master branch (0.7.x unstable) uses a new V8 which resolves the issue and is **required** to make this work.\n\nIf you are using Node 0.7.x and are still getting \"Illegal Access\" errors I have a pull request that solves this issue (along with greatly improving util.inspect) here https://github.com/joyent/node/pull/2360. It should be integrated into Node's master branch soon and hopefully will be available along with the fixed V8 implementation for Node 0.8.","maintainers":[{"name":"benvie","email":"brandon@bbenvie.com"}]},"0.1.3":{"author":{"name":"Brandon Benvie","email":"brandon@bbenvie.com","url":"http://bbenvie.com"},"name":"meta-objects","description":"Utilities and patterns for using Harmony Proxies to meta-program. Proxies as Proxy handlers, catch all forwarders for catch all forwarders, intercession introspection. Now you're thinking with portals.","keywords":["harmony","proxy","meta","objects","membrane","ecmascript","functional","partial","weakmap","trace"],"version":"0.1.3","repository":{"url":"https://github.com/Benvie/meta-objects"},"main":"./index.js","engines":{"node":">=0.6.6"},"dependencies":{"direct-proxies":"0.1.0"},"devDependencies":{},"_npmUser":{"name":"benvie","email":"brandon@bbenvie.com"},"_id":"meta-objects@0.1.3","_engineSupported":true,"_npmVersion":"1.1.0-beta-4","_nodeVersion":"v0.7.0-pre","_defaultsLoaded":true,"dist":{"shasum":"06f8f9e72fd67f64513a167b71507cdfc8eb0245","tarball":"https://registry.npmjs.org/meta-objects/-/meta-objects-0.1.3.tgz","integrity":"sha512-/8ylgrPxWS3DmbHJSThDpYmipBgRoD/LbtFHHWLDlK03GQbYK79fA6ejWmfcoUoRPnkrAp4t4U+NwHRcoqdvVA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDnTIjxe4FvdMwCl3bY+W15nN5jxwZ86xrNYaayKT/QvAIgEZfiqdIpiUkIJwWjnZtEeXpdBRl+4XSmIofAD94AMak="}]},"readme":"# meta-objects\n\nThis repo is in flux now due to the new revision of the Proxy API approved at the end of november. Direct Proxies make most of the work previously in this repo very easy to do. The API is much easier to work with.\n\n# Basic Usage\n\nAt first only one function is exposed. This function bootstraps a few shims onto the context without which the rest wouldn't work. This function will return the actual module once you run it.\n\n    var meta = require('meta-objects')();\n\n\n# Direct Proxy Shim for both Node and Spidermonkey/Firefox\n\nThanks to the hard work of [Tom Van Cutsem](https://github.com/tvcutsem) in both producing the API to begin with along with a shim to provide the functionality on top of existing Proxy functionality, we can start working with the API before browsers implement it. I've created a minimal wrapper around it for use as a node module. All of the work going forward will be based on this API rather than the old one.\n\nhttps://github.com/Benvie/Direct-Proxies-Shim-for-Node\n\n\n# Current Feature Set\n\nUpdated API. Now focusing specifically on Proxy related functionality rather than also having a lot of utilities. More docs to come.\n\n    { createPartial:     [Function: createPartial],\n      createFunction:    [Function: createFunction],\n      createDispatcher:  [Function: createDispatcher],\n      WrapMap:           [Constructor: WrapMap],\n      WeakMapSet:        [Constructor: WeakMapSet] }\n\n\n\n# Function.create\n\nNot possible to implemented without Proxies, meta-objects provides the `createFunction` function.\n\n    createFunction([name, [onCall, [onConstruct]]]);\n\nAll arguments are optional. This function enables a few unique use-cases:\n\n* Rename existing function. Provide a name and a function and the return is a function that works exactly the same, but has a different `name`, which will faithfully be shown by consoles and other debuggers.\n\n   var renamed = createFunction('someName', function(){ return arguments.callee.name });\n\n* Meld a call handler and a constructor into one. Provide two functions, one for calling and one for constructing, and they'll be represented by one single public entity, even in fn.prototype.constructor.\n\n```javascript\nfunction callHandler(){ console.log('called') }\nfunction Ctor(){ this.madeFrom = 'Ctor' }\nCtor.prototype.isWinning = true;\n\nvar myCrazyClass = createFunction('CrazyClass', callHandler, Ctor);\n\nconsole.log(myCrazyClass);\n  // -->\n    { [Constructor: CrazyClass]\n      prototype: { isWinning: true } }\n\nmyCrazyClass();\n  // --> 'called';\nnew myCrazyClass;\n  // -->\n    { madeFrom: 'Ctor',\n      [__proto__]: { isWinning: true } };\n```\n\n* Clone a function to give it a new identity without changing it in any other way. Useful for things like WeakMaps (require unique identity) or adding properties without tainting the original.\n\n    var newObjectDotCreate = createFunction(Object.create); //[Function: create]\n\n\n\n# Partials - Using meta objects for partial function factories\n\n```javascript\nvar meta = require('../lib')();\n\nvar createPartial = meta.createPartial;\nvar __   = createPartial.__;\nvar ____ = createPartial.____;\nvar $$$  = createPartial.$$$;\n\n\n\nvar sliceFactory = createPartial(Array.prototype.slice);\n\n/*\n  fake sources generated by the factory for factory.toString()\n  The source is not actually run and the actual internal operation\n  runs differently than this code, but it achieves the same end result */\n\nsliceFactory.$this = $$$;\nconsole.log(sliceFactory+'')\n  // ->\n    function slice_factory($0){\n      return (function slice_partial($1){\n        return (function slice(){\n        [native code]\n        }).call($0 || $1 || this);\n      });\n    }\n\n\nvar slicepartial = sliceFactory();\nconsole.log(slicepartial([1, 2, 3], 2))\n  // -> [ 3 ]\n\n// `new` creates a clone snapshot of the factory but they don't share state after\nvar factory2 = new sliceFactory;\nfactory2.$0 = 1;\nvar partial2 = factory2();\nconsole.log(partial2([1, 2, 3]))\n  // -> [ 2, 3 ]\n\n\n\n\nfunction someFn(someArgs, itWillRead, andUse){\n  if (typeof someArgs === 'function') {\n    var val = someArgs(this.someProperty, \"whatever\");\n  }\n  return itWillRead() ? val : andUse;\n}\n\nvar someFnFactory = createPartial(someFn);\nconsole.log(someFnFactory)\n  // ->\n    { [Function: someFn_factory]\n       someArgs:     __,\n       itWillRead:   __,\n       andUse:       __    }\n\nsomeFnFactory.someArgs = Array;\nsomeFnFactory.itWillRead = ____;\nsomeFnFactory.$this = { someProperty: \"yeah\" };\n\nconsole.log(someFnFactory)\n  // ->\n    { [Function: someFn_factory]\n      someArgs:    Array,\n      itWillRead:  ____,\n      andUse:      __     }\n\nconsole.log(someFnFactory+'')\n  // ->\n      function someFn_factory(itWillRead){\n        var someArgs = this.someArgs;\n        var $this = this.$this;\n        return (function someFn_partial(andUse){\n          return (function someFn(someArgs, itWillRead, andUse){\n            if (typeof someArgs === 'function') {\n              var val = someArgs(this.someProperty, \"whatever\");\n            }\n            return itWillRead() ? val : andUse;\n          }).call($this, someArgs, itWillRead, andUse);\n        });\n      }\n\n\n\nvar somePartial = someFnFactory(Date);\n// copying it before we do anything to it\nvar copied = new somePartial;\n\n//matches the corrsponeding inner function above\nconsole.log(somePartial+'')\n  // ->\n    function someFn_partial(andUse){\n      return (function someFn(someArgs, itWillRead, andUse){\n        if (typeof someArgs === 'function') {\n          var val = someArgs(this.someProperty, \"whatever\");\n        }\n        return itWillRead() ? val : andUse;\n      }).call($this, someArgs, itWillRead, andUse);\n    }\n\nconsole.log(somePartial)\n  // ->\n    { [Function: someFn_partial]\n      someArgs:     Array,\n      itWillRead:   Date,\n      andUse:       __     }\n\n\nconsole.log(somePartial(1337));\n  // ->\n    //[ \"yeah\", \"whatever\" ]\n\n\nconsole.log(somePartial)\n/* identity is refreshed upon fulfillment, the final call isn't saved\n  // ->\n    { [Function: someFn_partial]\n      someArgs:     Array,\n      itWillRead:   Date,\n      andUse:       __     }\n\n```\n\n# Direct Proxies Usage\n\n```javascript\n// initialize on context\nrequire('direct-proxies').shim(); // a context, `global` is default\n\n\n// `Proxy` itself is now the creator for all proxies\nvar proxy = Proxy(target, handler);\n\n\n// all traps now have their first parameter as `target` referencing the real object\n{ getOwnPropertyDescriptor: function(target, name) }\n\n\n// new global `Reflect` contains default traps\nglobal.Reflect:\n { getOwnPropertyDescriptor,  // non-own `getProperty[Names|Descriptor]` gone\n   getOwnPropertyNames,\n   defineProperty,\n   deleteProperty,            // name changed\n   freeze,                    // freeze/seal/preventExtensions separated\n   seal,\n   preventExtensions,\n   has,\n   hasOwn,\n   get,\n   set,\n   enumerate,\n   iterate,\n   keys,\n   apply,                     // apply/new are now traps on the handler\n   construct }\n\n\n// for virtualized objects you can use this for your handler.prototype\n// it implements some handlers but requires the others, like old fundamental traps\nglobal.Reflect.VirtualHandler.prototype\n abstract { getOwnPropertyDescriptor,\n abstract   getOwnPropertyNames,\n abstract   defineProperty,\n abstract   deleteProperty,\n            freeze,\n            seal,\n abstract   preventExtensions,\n            has,\n            hasOwn,\n            get,\n            set,\n            enumerate,\n            iterate,\n            keys,\n abstract   apply,\n            construct }\n```\n\n\n# Compatability\n\nThe current stable Node.js branch, 0.6.x, uses a version of V8 with bugs that makes it incompatible with this shim. Node's master branch (0.7.x unstable) uses a new V8 which resolves the issue and is **required** to make this work.\n\nIf you are using Node 0.7.x and are still getting \"Illegal Access\" errors I have a pull request that solves this issue (along with greatly improving util.inspect) here https://github.com/joyent/node/pull/2360. It should be integrated into Node's master branch soon and hopefully will be available along with the fixed V8 implementation for Node 0.8.","maintainers":[{"name":"benvie","email":"brandon@bbenvie.com"}]},"0.1.4":{"author":{"name":"Brandon Benvie","email":"brandon@bbenvie.com","url":"http://bbenvie.com"},"name":"meta-objects","description":"Utilities and patterns for using Harmony Proxies to meta-program. Proxies as Proxy handlers, catch all forwarders for catch all forwarders, intercession introspection. Now you're thinking with portals.","keywords":["harmony","proxy","meta","objects","membrane","ecmascript","functional","partial","weakmap","trace"],"version":"0.1.4","repository":{"url":"https://github.com/Benvie/meta-objects"},"main":"./index.js","engines":{"node":">=0.6.6"},"dependencies":{},"devDependencies":{},"_npmUser":{"name":"benvie","email":"brandon@bbenvie.com"},"_id":"meta-objects@0.1.4","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.15","_nodeVersion":"v0.7.7","_defaultsLoaded":true,"dist":{"shasum":"356a3aa18f9159826be194f3e746ddd48cf11bf5","tarball":"https://registry.npmjs.org/meta-objects/-/meta-objects-0.1.4.tgz","integrity":"sha512-IWhFLQAwhiTUgD3hQhVvdjj+91gvtoAOPgwF1zbYajkJmekiPK9JR+jwT5N/9jZ+XhSAh9NCtJcXNKbGdxQ+vA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDk5UPtvK+7z4Ko6I0cMdY/jLN39esM91b+Ftt+n/ESkwIhAI0/fHDHo/SbVu+PaAEnInupjNhqURuRT4yOUXunP6wk"}]},"readme":"# meta-objects\n\nReworked for the third time. This time it's actually a bit more useful. Direct-Proxies have been replaced with a similar but much trimmed down meta handler called EasyProxy. The complexity and lack of compatability with Direct Proxies in current v\n\n# Compatability\n\nAll of the functionality should work in Node 0.7-0.8, Chrome 18-19, and Firefox 4-11. It is likely that the library at some point will stop working unless updated to reflect the coming changes to the Proxy API which are not compatible. This will likely happen sometime in the next few months but you can expect this library will be updated to reflect that.\n\nIn Node you must be running node using `node --harmony`. In Chrome you must run with the `Experimental JavaScript` flag on (go to URL \"about:flags\", near the bottom).","maintainers":[{"name":"benvie","email":"brandon@bbenvie.com"}]},"0.1.5":{"author":{"name":"Brandon Benvie","email":"brandon@bbenvie.com","url":"http://bbenvie.com"},"name":"meta-objects","description":"Utilities and patterns for using Harmony Proxies to meta-program. Proxies as Proxy handlers, catch all forwarders for catch all forwarders, intercession introspection. Now you're thinking with portals.","keywords":["harmony","proxy","meta","objects","membrane","ecmascript","functional","partial","weakmap","trace"],"version":"0.1.5","repository":{"url":"https://github.com/Benvie/meta-objects"},"main":"./index.js","engines":{"node":">=0.6.6"},"dependencies":{},"devDependencies":{},"_npmUser":{"name":"benvie","email":"brandon@bbenvie.com"},"_id":"meta-objects@0.1.5","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.15","_nodeVersion":"v0.7.7","_defaultsLoaded":true,"dist":{"shasum":"4d5e25163d22448b805386c7ec8f502d03351415","tarball":"https://registry.npmjs.org/meta-objects/-/meta-objects-0.1.5.tgz","integrity":"sha512-+ruqXQ0aFOTQmfU4ofTYmJobgu+46lKJEZ6vStEsOD6WeqLuXu85skmEDeLNHDwWBkjYbwmfVCJUzStqbLQBrg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDVZfvQWXqGO+qiVBut2jbaUapxNTa8qxgTVea4XPHLjwIhAPUBnO04tpnCokAjs6wnwjZcGEsd2F8R/u2wusUiPAWa"}]},"readme":"# meta-objects\n\nReworked for the third time. This time it's actually a bit more useful. Direct-Proxies have been replaced with a similar but much trimmed down meta handler called EasyProxy. The complexity and lack of compatability with Direct Proxies in current v\n\n# Compatability\n\nAll of the functionality should work in Node 0.7-0.8, Chrome 18-19, and Firefox 4-11. It is likely that the library at some point will stop working unless updated to reflect the coming changes to the Proxy API which are not compatible. This will likely happen sometime in the next few months but you can expect this library will be updated to reflect that.\n\nIn Node you must be running node using `node --harmony`. In Chrome you must run with the `Experimental JavaScript` flag on (go to URL \"about:flags\", near the bottom).","maintainers":[{"name":"benvie","email":"brandon@bbenvie.com"}]},"0.1.6":{"author":{"name":"Brandon Benvie","email":"brandon@bbenvie.com","url":"http://bbenvie.com"},"name":"meta-objects","description":"Utilities and patterns for using Harmony Proxies to meta-program. Proxies as Proxy handlers, catch all forwarders for catch all forwarders, intercession introspection. Now you're thinking with portals.","keywords":["harmony","proxy","meta","objects","membrane","ecmascript","functional","partial","weakmap","trace"],"version":"0.1.6","repository":{"url":"https://github.com/Benvie/meta-objects"},"main":"./index.js","engines":{"node":">=0.6.6"},"dependencies":{},"devDependencies":{},"_npmUser":{"name":"benvie","email":"brandon@bbenvie.com"},"_id":"meta-objects@0.1.6","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.15","_nodeVersion":"v0.7.7","_defaultsLoaded":true,"dist":{"shasum":"b1c39fc15c336e36c1a789922fbf8f63c96d257b","tarball":"https://registry.npmjs.org/meta-objects/-/meta-objects-0.1.6.tgz","integrity":"sha512-Pcutqw5q143SfZ2ZE5LCm9kBM64QH8mk001iT89EqarftZDYxsUu25s7f/mp9+RwQHrauccs64wij7J3JQrNFA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDK8NkkOEVpWCfQAXzcilO0XhdCggJGJ/ZQEFsUv9e4/AiAJlMU8xRDDAisIGZ/rVGFHdayR6w/2XvVDcQJzHRVQ9A=="}]},"readme":"# meta-objects\n\nReworked for the third time. This time it's actually a bit more useful. Direct-Proxies have been replaced with a similar but much trimmed down meta handler called EasyProxy. The complexity and lack of compatability with Direct Proxies in current v\n\n# Compatability\n\nAll of the functionality should work in Node 0.7-0.8, Chrome 18-19, and Firefox 4-11. It is likely that the library at some point will stop working unless updated to reflect the coming changes to the Proxy API which are not compatible. This will likely happen sometime in the next few months but you can expect this library will be updated to reflect that.\n\nIn Node you must be running node using `node --harmony`. In Chrome you must run with the `Experimental JavaScript` flag on (go to URL \"about:flags\", near the bottom).","maintainers":[{"name":"benvie","email":"brandon@bbenvie.com"}]},"0.1.7":{"author":{"name":"Brandon Benvie","email":"brandon@bbenvie.com","url":"http://bbenvie.com"},"name":"meta-objects","description":"Utilities and patterns for using Harmony Proxies to meta-program. Proxies as Proxy handlers, catch all forwarders for catch all forwarders, intercession introspection. Now you're thinking with portals.","keywords":["harmony","proxy","meta","objects","membrane","ecmascript","functional","partial","weakmap","trace"],"version":"0.1.7","repository":{"url":"https://github.com/Benvie/meta-objects"},"main":"./index.js","engines":{"node":">=0.6.6"},"dependencies":{},"devDependencies":{},"_npmUser":{"name":"benvie","email":"brandon@bbenvie.com"},"_id":"meta-objects@0.1.7","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.15","_nodeVersion":"v0.7.7","_defaultsLoaded":true,"dist":{"shasum":"b7069c9b5e8707076bfc1963ca4faf026b737a3c","tarball":"https://registry.npmjs.org/meta-objects/-/meta-objects-0.1.7.tgz","integrity":"sha512-ggFzsvtnutoqEw0du+XLiUkpZ/PzcX9K+yDVGfYUWMcXewmqNHceqgUwM8dI5MhwKlXK5deloLRnpQ/Av6aqjQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGdDdXZEJLABqa68G8nv2g7ZTOXL5376wk15ECiRSypOAiEAh2oSxE1TwOhfPi8pOGb4n7PVA8rKQSz/Q/MG6i7LOQo="}]},"readme":"# meta-objects\n\nReworked for the third time. This time it's actually a bit more useful. Direct-Proxies have been replaced with a similar but much trimmed down meta handler called EasyProxy. The complexity and lack of compatability with Direct Proxies in current v\n\n# Compatability\n\nAll of the functionality should work in Node 0.7-0.8, Chrome 18-19, and Firefox 4-11. It is likely that the library at some point will stop working unless updated to reflect the coming changes to the Proxy API which are not compatible. This will likely happen sometime in the next few months but you can expect this library will be updated to reflect that.\n\nIn Node you must be running node using `node --harmony`. In Chrome you must run with the `Experimental JavaScript` flag on (go to URL \"about:flags\", near the bottom).","maintainers":[{"name":"benvie","email":"brandon@bbenvie.com"}]},"0.1.8":{"author":{"name":"Brandon Benvie","email":"brandon@bbenvie.com","url":"http://bbenvie.com"},"name":"meta-objects","description":"Utilities and patterns for using Harmony Proxies to meta-program. Proxies as Proxy handlers, catch all forwarders for catch all forwarders, intercession introspection. Now you're thinking with portals.","keywords":["harmony","proxy","meta","objects","membrane","ecmascript","functional","partial","weakmap","trace"],"version":"0.1.8","repository":{"url":"https://github.com/Benvie/meta-objects"},"main":"./index.js","engines":{"node":">=0.6.6"},"dependencies":{},"devDependencies":{},"_npmUser":{"name":"benvie","email":"brandon@bbenvie.com"},"_id":"meta-objects@0.1.8","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.15","_nodeVersion":"v0.7.7","_defaultsLoaded":true,"dist":{"shasum":"7d6306412ed863d8ae98b73105cec85ea056ca3f","tarball":"https://registry.npmjs.org/meta-objects/-/meta-objects-0.1.8.tgz","integrity":"sha512-/yxRUpTxM9yK8l6LxMMv3tkTejVRNZJ5lUcSbD36XzdfUudDOgkVxPq3eGkLRct00HCYKtUDtWxCU6+XrROQ8g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFLqT7uc9dBxeqFsnYHV+ncpk7bXSxFWRjBO8ShUOJnhAiEAnmNlJe/7x2sjwgUNVK/fMCZfYdZZXIiv7N3yiOZcgpk="}]},"readme":"# meta-objects\n\nReworked for the third time. This time it's actually a bit more useful. Direct-Proxies have been replaced with a similar but much trimmed down meta handler called EasyProxy.\n\n# install\n\nIt can be used in browsers where Proxy is available or in node. For browsers you'll need to combine the files, but it's set up to be usable as is aside from that. For node:\n```\nnpm install meta-objects\n```\n\n# usage\nThis library has a combination of tools both for creating meta-objects handlers/APIs themselves, as well as some full ready-for-use ones. First up are ready to use tools:\n\n## Multiple Inheritance\nThe __multiInherit__ function provided allows for simple creation of classes that inherit from multiple objects. That is, you provide a set of constructors (and implicitly the `.prototype` for each) and in return you receive a single constructor with a single prototype. The constructor invokes all of the provided constructors in the order provided. The prototype combines all of the properties of the prototypes, in preference to the order provided.\n\n__multiInherit(constructors, parameterNames, [ctorName])__\n\n* __constructors__ is an array of constructors that will be composed. The `prototype` property will be used for determining the list of prototypes.\n* __parameterNames__(strings) is an array of names that will be used to map params given to the combined ctor to each of the individual ctors. The names are matched to the named parameters of each ctor.\n`__multiInherit([Ctor1, Ctor2, Ctor3], ['name', 'size', 'etc', 'etc2'])`\n* __parameterNames__(number arrays) can be used instead to map the parameters by input order to the matching index ctor.\n`__multiInherit([Ctor1, Ctor2, Ctor3], [[2,3,4], [1,2], [4,5,6]])`\n* __name__ optionally sets a specific name for the resulting Ctor. If not provided it will be made from combining the names of the given ctors.\n\n```javascript\nfunction Talks(name, says){\n  this.name = name;\n  this.says = says;\n}\n\nTalks.prototype = {\n  speak: function speak(at){\n    at(this.name + ' says: ' + this.says);\n  }\n};\n\n\nfunction Walks(name, stride){\n  this.name = name;\n  this.stride = stride;\n}\n\nWalks.prototype = {\n  move: function move(where){\n    var self = this;\n    setTimeout(function(){\n      where[self.name] = self;\n      self.location = where;\n    }, this.stride);\n  }\n}\n\n\nfunction Fondles(desires){\n  this.desires = desires;\n}\n\nFondles.prototype = {\n  touch: function touch(who){\n    this.felt = who[this.desires];\n  }\n};\n\n// parameter names are used to map the combined ctor's parameters to the set of constructors\nvar WalksTalksFondles = multiInherit([Walks, Talks, Fondles], ['name', 'says', 'stride', 'desires']);\nconsole.log(WalksTalksFondles)\n//-->\n  [Function: WalksTalksFondles]\n\n// the combined prototype can also have its own properties separate from any it inherits\nWalksTalksFondles.prototype.type = 'man';\n\n// the inheritance is dynamic, just like normal [[prototypes]]\nWalks.prototype.speed = 1000;\n\nconsole.log(WalksTalksFondles.prototype)\n//-->\n  { type: 'man',\n    move: [Function: move],\n    speed: 1000,\n    speak: [Function: speak],\n    touch: [Function: touch] }\n\n\nvar bob = new WalksTalksFondles('bob', 'hey guys', 100, 'name');\nbob.touch(Object)\nbob.speak(console.log); //bob says: hey guys\nconsole.log(bob);\n//-->\n  { name: 'bob',\n    stride: 100,\n    says: 'hey guys',\n    desires: 'name',\n    felt: 'Object' }\n\nconsole.log(bob.constructor)\n//-->\n  [Function: WalksTalksFondles]\n\n```\n\n\n## ObjectEmitter\nObjectEmitter takes any object and produces an event emitter along with a clone of the object. All interactions with the cloned version will be broadcast on the emitter. The clone object can be interacted with in any way as if it were the real object. What's more, any sub-object gotten from the clone will also be a clone that broadcasts to the emitter. Any object, whether from property access, or method invocation, or `new` will emit events through the single emitter.\n\n```javascript\nvar emitter = new ObjectEmitter(function Test(){ this.name = 'bob' }, 'Test');\nemitter.on('*', function(event){\n  if (event.property) {\n    console.log(event.type, event.path.join('.'), event.property);\n  } else {\n    console.log(event.type, event.path.join('.'));\n  }\n});\n\nvar Test = emitter.Test;\nvar bob = new Test;\n\nconsole.log(bob);\n//-->\n  construct Test\n  get Test.[[0]] inspect  //instances created via construct are indexed and displayed as [[#]]\n  keys Test.[[0]]\n  describe Test.[[0]] name\n  { name: 'bob' }\n\nbob.stuff = { x: ['a',',b','c'] }\nconsole.log(bob.stuff.x[0]);\n\n//-->\n  set Test.[[0]] stuff\n  get Test.[[0]] stuff\n  get Test.[[0]].stuff x\n  get Test.[[0]].stuff.x 0\n  a\n```\n\n\n## proxy\nA easier to use proxy that's closer to the new Proxy spec than the old one, but with some niceities to make proxy handler creation much simpler. When creating a proxy you provide the object to mirror and the handler. The default action is to forward all actions to the provided target, no traps need be implemented at all. \n```javascript\nvar proxied = proxy(target, handler);\n```\n__Traps__\nSome traps have been renamed because I hate long names. Parameters have been reordered for convenience. The first parameter for all traps is `fwd`, a function that will forward the event to the target. It takes no arguments but has three properties which can be modified. `fwd` can be invoked multiple times, allowing you to, for example, mirror the action against two separate targets.\n\n* __fwd.target__ can be changed to forward the event to something else.\n* __fwd.args__ is an array with the arguments starting after target. For example, to change the property for traps against a specific property, you would do `fwd.args[0] = 'differentProperty'; fwd();`\n* __fwd.trap__ The string name of the trap. Changing this invokes a different forwarding action. For example, in the `keys` trap you could change it to `names` which would then show hidden properties instead of non-hidden ones.\n\n\n```javascript\nkeys      (fwd, target)\nnames     (fwd, target)\nenumerate (fwd, target)\nfix       (fwd, target)\nowns      (fwd, target, prop)\nhas       (fwd, target, prop)\ndelete    (fwd, target, prop)\ndescribe  (fwd, target, prop)\ndefine    (fwd, target, prop, descriptor)\nget       (fwd, target, prop, receiver)\nset       (fwd, target, prop, value, receiver)\napply     (fwd, target, args, receiver)\nconstruct (fwd, target, args)\n```\n\n## membrane\nTakes a proxy handler designed for the above proxy handler api and makes it into a membrane that automatically wraps all outbound objects and unwraps all inbound objects. The handlers only see unwrapped normal objects so it's no more complicated than creating a normal proxy.\n\n## Emitter\nAn object that's cross between DOM events and Node's EventEmitter. Event objects are either used or created which include information about the current target and type of event. Handlers and meta information aren't stored on the emitter itself which allows for separation of the event process and an objects normal operation. An emitter can \"forward\" all event subscriptions from itself to another object such that doing `obj.on('event', callback)` subscribes to events emitted by `obj2`.\n\nThe `this` binding for all callbacks is the emitter of the event, and the first parameter is and `event` object which includes the target of the event. This is usually the same as the emitter, but as in browsers, it may be different. If events are forwarded to another object, or if you're listening to a prototype and getting __all__ events for every instance, the `this` binding will be the object you actually did `emitter.on` to, and the target will be the object responsible for emitting the event.\n\n## WrapMap\nA utility class for simplifying usage of creating wrapper/unwrappers that use WeakMaps. Simply provide a callback function that accepts an input unwrapped object and returns a wrapped version. The result is a `WrapMap` instance with the following functions\n\n* wrap - Wraps objects if they aren't already wrapped. Returns primitives and wrapped objects unmodified.\n* unwrap - Unwraps wrapped objects and returns primitives and unwrapped objects unmodified.\n* wrapDescriptor - Applies the wrapper to `obj.value`, `obj.set`, and `obj.set` but not the base object itself. Modifies the descriptor.\n* unwrapDescriptor - Unwraps `value`, `set`, and `get`. Modifies the descriptor.\n* remove - Unwrap object and remove from the map, returning the unwrapped object.\n* has - Boolean testing if a given object is wrapped.\n\n```javascript\nvar arrayer = new WrapMap(function(obj){\n  return [];\n});\n\nvar test = arrayer.wrap(function test(){});\nconsole.log(test);\n//-->\n  []\n\nconsole.log(arrayer.unwrap(test));\n//-->\n  [Function: test];\n```\n\n\n# Compatability\n\nAll of the functionality should work in Node 0.7-0.8, Chrome 18-19, and Firefox 4-11. It is likely that the library at some point will stop working unless updated to reflect the coming changes to the Proxy API which are not compatible. This will likely happen sometime in the next few months but you can expect this library will be updated to reflect that.\n\nIn Node you must be running node using `node --harmony`. In Chrome you must run with the `Experimental JavaScript` flag on (go to URL \"about:flags\", near the bottom).","maintainers":[{"name":"benvie","email":"brandon@bbenvie.com"}]},"0.1.9":{"author":{"name":"Brandon Benvie","email":"brandon@bbenvie.com","url":"http://bbenvie.com"},"name":"meta-objects","description":"Utilities and patterns for using Harmony Proxies to meta-program. Proxies as Proxy handlers, catch all forwarders for catch all forwarders, intercession introspection. Now you're thinking with portals.","keywords":["harmony","proxy","meta","objects","membrane","ecmascript","functional","partial","weakmap","trace"],"version":"0.1.9","repository":{"url":"https://github.com/Benvie/meta-objects"},"main":"./index.js","engines":{"node":">=0.6.6"},"dependencies":{},"devDependencies":{},"_npmUser":{"name":"benvie","email":"brandon@bbenvie.com"},"_id":"meta-objects@0.1.9","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.15","_nodeVersion":"v0.7.8","_defaultsLoaded":true,"dist":{"shasum":"9b66038b9612b6832a9d0dc16d1c7ed3c5aa09d3","tarball":"https://registry.npmjs.org/meta-objects/-/meta-objects-0.1.9.tgz","integrity":"sha512-QmONB7DUuHLfOoiD6TuV+mMae041g0uAbMWjs3JdmyO9Wgv6zvel6MD0NrRkqRMAsfRS+hAyg6KTmRiDX5oVoA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBukiHKp03nJH9+BD0WGuD1ZY3PvSI4UYycJfVZu7rVgAiEAvr3vng0jy8rtHARir/brvyz1C8ch0bEZBHW6jMHge0Q="}]},"readme":"# meta-objects\n\nTools for making meta-objects.\n\n* __multiherit__ - Creates a meta class from multiple constructors that combines all of them into one. Prototypal inheritance with multiple prototypes and multiple constructors.\n* __tracer__ - Creates a clone object from the provided object that emits __all__ things that happen to it. It's like databinding on crack.\n* __proxy__ - Simplifies creation of ES6 proxies by handling everything you don't want to and providing ways to forward and subtly modify a target object.\n* __membrane__ - Accepts the same parameters that would be provided to __proxy__ but returns an object that will automatically wrap and unwrap all sub-objects gotten from property access, function calling, constructors, etc.\n* __WrapMap__ - Mostly internal use tool for wrapping/unwrapping objects, used by membranes.\n* __Emitter__ - A cross-between Node's emitters and the DOM event system. Used by tracer.\n\n\n# Install\n\nIt can be used in browsers where Proxy is available or in node. \n\n__Browser__\nThis library works in Firefox 4+ or Chrome 18+ with the `experimental javascript` flag enabled.\n```html\n<script src=\"meta-objects.browser.min.js\"></script>\n<scrript>console.log(meta)</scrript>\n```\n__Node.js__\nThis library works with Node 0.7+ when run like so `node --harmony`.\n```\nnpm install meta-objects\n```\n```javascript\nvar meta = require('meta-objects');\nconsole.log(meta);\n```\n\n## Multiple Inheritance\nThe __multiherit__ function provided allows for simple creation of classes that inherit from multiple objects. That is, you provide a set of constructors (and implicitly the `.prototype` for each) and in return you receive a single constructor with a single prototype. The constructor invokes all of the provided constructors in the order provided. The prototype combines all of the properties of the prototypes, in preference to the order provided.\n\n__multiherit(constructors, parameterNames, [ctorName])__\n\n* __constructors__ is an array of constructors that will be composed. The `prototype` property will be used for determining the list of prototypes.\n* __parameterNames__(strings) is an array of names that will be used to map params given to the combined ctor to each of the individual ctors. The names are matched to the named parameters of each ctor.\n`__multiherit([Ctor1, Ctor2, Ctor3], ['name', 'size', 'etc', 'etc2'])`\n* __parameterNames__(number arrays) can be used instead to map the parameters by input order to the matching index ctor.\n`__multiherit([Ctor1, Ctor2, Ctor3], [[2,3,4], [1,2], [4,5,6]])`\n* __name__ optionally sets a specific name for the resulting Ctor. If not provided it will be made from combining the names of the given ctors.\n\n```javascript\nfunction Talks(name, says){\n  this.name = name;\n  this.says = says;\n}\n\nTalks.prototype = {\n  speak: function speak(at){\n    at(this.name + ' says: ' + this.says);\n  }\n};\n\nfunction Walks(name, stride){\n  this.name = name;\n  this.stride = stride;\n}\n\nWalks.prototype = {\n  move: function move(where){\n    var self = this;\n    setTimeout(function(){\n      where[self.name] = self;\n      self.location = where;\n    }, this.stride);\n  }\n}\n\nfunction Fondles(desires){\n  this.desires = desires;\n}\n\nFondles.prototype = {\n  touch: function touch(who){\n    this.felt = who[this.desires];\n  }\n};\n\n// parameter names are used to map the combined ctor's parameters to the set of constructors\nvar WalksTalksFondles = meta.multiherit([Walks, Talks, Fondles], ['name', 'says', 'stride', 'desires']);\nconsole.log(WalksTalksFondles)\n//-->\n  [Function: WalksTalksFondles]\n\n// the combined prototype can also have its own properties separate from any it inherits\nWalksTalksFondles.prototype.type = 'man';\n\n// the inheritance is dynamic, just like normal [[prototypes]]\nWalks.prototype.speed = 1000;\n\nconsole.log(WalksTalksFondles.prototype)\n//-->\n  { type: 'man',\n    move: [Function: move],\n    speed: 1000,\n    speak: [Function: speak],\n    touch: [Function: touch] }\n\n\nvar bob = new WalksTalksFondles('bob', 'hey guys', 100, 'name');\nbob.touch(Object)\nbob.speak(console.log); //bob says: hey guys\nconsole.log(bob);\n//-->\n  { name: 'bob',\n    stride: 100,\n    says: 'hey guys',\n    desires: 'name',\n    felt: 'Object' }\n\nconsole.log(bob.constructor)\n//-->\n  [Function: WalksTalksFondles]\n\n```\n\n\n## Tracer Objects\nThe `tracer` function takes any object and produces an event emitter along with a clone of the object. All interactions with the cloned version will be broadcast from the emitter. The clone can be interacted with in any way as if it were the real object. Any sub-object gotten from the clone through property access, function calling, constructors, etc. will also be a clone that broadcasts to the emitter.\n\n```javascript\nvar emitter = meta.tracer(function Test(){ this.name = 'bob' }, 'Test');\nemitter.on('*', function(event){\n  if (event.property) {\n    console.log(event.type, event.path.join('.'), event.property);\n  } else {\n    console.log(event.type, event.path.join('.'));\n  }\n});\n\nvar Test = emitter.Test;\nvar bob = new Test;\n\nconsole.log(bob);\n//-->\n  construct Test\n  get Test.[[0]] inspect  // instances created via construct are indexed and displayed as [[#]]\n  keys Test.[[0]]\n  describe Test.[[0]] name\n  { name: 'bob' }\n\nbob.stuff = { x: ['a',',b','c'] }\nconsole.log(bob.stuff.x[0]);\n\n//-->\n  set Test.[[0]] stuff\n  get Test.[[0]] stuff\n  get Test.[[0]].stuff x\n  get Test.[[0]].stuff.x 0\n  a\n```\n\n\n## proxy\nA easier to use proxy that's closer to the new Proxy spec than the old one, but with some niceities to make proxy handler creation much simpler. When creating a proxy you provide the object to mirror and the handler. The default action is to forward all actions to the provided target, no traps need be implemented at all.\n```javascript\nvar proxied = meta.proxy(target, handler);\n```\n__Traps__\nSome traps have been renamed because I hate long names. Parameters have been reordered for convenience. The first parameter for all traps is `fwd`, a function that will forward the event to the target. It takes no arguments but has three properties which can be modified. `fwd` can be invoked multiple times, allowing you to, for example, mirror the action against two separate targets.\n\n* __fwd.target__ can be changed to forward the event to something else.\n* __fwd.args__ is an array with the arguments starting after target. For example, to change the property for traps against a specific property, you would do `fwd.args[0] = 'differentProperty'; fwd();`\n* __fwd.trap__ The string name of the trap. Changing this invokes a different forwarding action. For example, in the `keys` trap you could change it to `names` which would then show hidden properties instead of non-hidden ones.\n\n\n```javascript\nkeys      [fwd, target]\nnames     [fwd, target]\nenumerate [fwd, target]\nfix       [fwd, target]\nowns      [fwd, target, prop]\nhas       [fwd, target, prop]\ndelete    [fwd, target, prop]\ndescribe  [fwd, target, prop]\ndefine    [fwd, target, prop, descriptor]\nget       [fwd, target, prop, receiver]\nset       [fwd, target, prop, value, receiver]\napply     [fwd, target, args, receiver]\nconstruct [fwd, target, args]\n```\n\n## membrane\nTakes a proxy handler designed for the above proxy handler api and makes it into a membrane that automatically wraps all outbound objects and unwraps all inbound objects. The handlers only see unwrapped normal objects so it's no more complicated than creating a normal proxy.\n\n## Emitter\nAn object that's cross between DOM events and Node's EventEmitter. Event objects are either used or created which include information about the current target and type of event. Handlers and meta information aren't stored on the emitter itself which allows for separation of the event process and an objects normal operation. An emitter can \"forward\" all event subscriptions from itself to another object such that doing `obj.on('event', callback)` subscribes to events emitted by `obj2`.\n\nThe `this` binding for all callbacks is the emitter of the event, and the first parameter is and `event` object which includes the target of the event. This is usually the same as the emitter, but as in browsers, it may be different. If events are forwarded to another object, or if you're listening to a prototype and getting __all__ events for every instance, the `this` binding will be the object you actually did `emitter.on` to, and the target will be the object responsible for emitting the event.\n\n## WrapMap\nA utility class for simplifying usage of creating wrapper/unwrappers that use WeakMaps. Simply provide a callback function that accepts an input unwrapped object and returns a wrapped version. The result is a `WrapMap` instance with the following functions\n\n* wrap - Wraps objects if they aren't already wrapped. Returns primitives and wrapped objects unmodified.\n* unwrap - Unwraps wrapped objects and returns primitives and unwrapped objects unmodified.\n* wrapDescriptor - Applies the wrapper to `obj.value`, `obj.set`, and `obj.set` but not the base object itself. Modifies the descriptor.\n* unwrapDescriptor - Unwraps `value`, `set`, and `get`. Modifies the descriptor.\n* remove - Unwrap object and remove from the map, returning the unwrapped object.\n* has - Boolean testing if a given object is wrapped.\n\n```javascript\nvar arrayer = new WrapMap(function(obj){\n  return [];\n});\n\nvar test = arrayer.wrap(function test(){});\nconsole.log(test);\n//-->\n  []\n\nconsole.log(arrayer.unwrap(test));\n//-->\n  [Function: test];\n```","maintainers":[{"name":"benvie","email":"brandon@bbenvie.com"}]},"0.2.0":{"author":{"name":"Brandon Benvie","email":"brandon@bbenvie.com","url":"http://bbenvie.com"},"name":"meta-objects","description":"Utilities and patterns for using Harmony Proxies to meta-program. Proxies as Proxy handlers, catch all forwarders for catch all forwarders, intercession introspection. Now you're thinking with portals.","keywords":["harmony","proxy","meta","objects","membrane","ecmascript","functional","partial","weakmap","trace"],"version":"0.2.0","repository":{"url":"https://github.com/Benvie/meta-objects"},"main":"./index.js","engines":{"node":">=0.6.6"},"dependencies":{},"devDependencies":{},"_npmUser":{"name":"benvie","email":"brandon@bbenvie.com"},"_id":"meta-objects@0.2.0","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.15","_nodeVersion":"v0.7.8","_defaultsLoaded":true,"dist":{"shasum":"f7fb6288a639171512773e628b0147d152e55365","tarball":"https://registry.npmjs.org/meta-objects/-/meta-objects-0.2.0.tgz","integrity":"sha512-C5hX2iEtQane8k82wldMR5/Fycmu2cZ1sbv8VQErVAiDAWhPD0VjWyQco1kGjABKLZTdjwwAHQlZNQpnxrYLSA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCRuiGku42fVQz7FZs0CkLhFyiFlSzMIqxpzMJTsmZp5wIhAIiN9gs3E1TSYkN1cMnQqk7w3ZOaNiBwxXMhLYFWTCl1"}]},"readme":"# meta-objects\n\nTools for making meta-objects.\n\n* __multiherit__ - Creates a meta class from multiple constructors that combines all of them into one. Prototypal inheritance with multiple prototypes and multiple constructors.\n* __tracer__ - Creates a clone object from the provided object that emits __all__ things that happen to it. It's like databinding on crack.\n* __proxy__ - Simplifies creation of ES6 proxies by handling everything you don't want to and providing ways to forward and subtly modify a target object.\n* __membrane__ - Accepts the same parameters that would be provided to __proxy__ but returns an object that will automatically wrap and unwrap all sub-objects gotten from property access, function calling, constructors, etc.\n* __WrapMap__ - Mostly internal use tool for wrapping/unwrapping objects, used by membranes.\n* __Emitter__ - A cross-between Node's emitters and the DOM event system. Used by tracer.\n\n\n# Install\n\nIt can be used in browsers where Proxy is available or in node. \n\n__Browser__\nThis library works in Firefox 4+ or Chrome 18+ with the `experimental javascript` flag enabled.\n```html\n<script src=\"meta-objects.browser.min.js\"></script>\n<scrript>console.log(meta)</scrript>\n```\n__Node.js__\nThis library works with Node 0.7+ when run like so `node --harmony`.\n```\nnpm install meta-objects\n```\n```javascript\nvar meta = require('meta-objects');\nconsole.log(meta);\n```\n\n## Multiple Inheritance\nThe __multiherit__ function provided allows for simple creation of classes that inherit from multiple objects. That is, you provide a set of constructors (and implicitly the `.prototype` for each) and in return you receive a single constructor with a single prototype. The constructor invokes all of the provided constructors in the order provided. The prototype combines all of the properties of the prototypes, in preference to the order provided.\n\n__multiherit(options)__\n\n* __options.ctors__ is an array of constructors that will be composed. The `prototype` property will be used for determining the list of prototypes.\n* __options.params__(strings) is an array of names that will be used to map params given to the combined ctor to each of the individual ctors. The names are matched to the named parameters of each ctor.\n* __options.params__(number arrays) can be used instead to map the parameters by input order to the matching index ctor.\n* __options.name__ optionally sets a specific name for the resulting Ctor. If not provided it will be made from combining the names of the given ctors.\n* __options.onCall__ optionally make instances callable and provide the function to call when they are called\n* __options.onConstruct__ optionally make instances constructable and provide the constructor function\n\n```javascript\nfunction Talks(name, says){\n  this.name = name;\n  this.says = says;\n}\n\nTalks.prototype = {\n  speak: function speak(at){\n    at(this.name + ' says: ' + this.says);\n  }\n};\n\nfunction Walks(name, stride){\n  this.name = name;\n  this.stride = stride;\n}\n\nWalks.prototype = {\n  move: function move(where){\n    var self = this;\n    setTimeout(function(){\n      where[self.name] = self;\n      self.location = where;\n    }, this.stride);\n  }\n}\n\nfunction Fondles(desires){\n  this.desires = desires;\n}\n\nFondles.prototype = {\n  touch: function touch(who){\n    this.felt = who[this.desires];\n  }\n};\n\n// parameter names are used to map the combined ctor's parameters to the set of constructors\nvar WalksTalksFondles = multiherit({\n  ctors: [Walks, Talks, Fondles],\n  params: ['name', 'says', 'stride', 'desires']\n});\nconsole.log(WalksTalksFondles)\n//-->\n  [Function: WalksTalksFondles]\n\n// the combined prototype can also have its own properties separate from any it inherits\nWalksTalksFondles.prototype.type = 'man';\n\n// the inheritance is dynamic, just like normal [[prototypes]]\nWalks.prototype.speed = 1000;\n\nconsole.log(WalksTalksFondles.prototype)\n//-->\n  { type: 'man',\n    move: [Function: move],\n    speed: 1000,\n    speak: [Function: speak],\n    touch: [Function: touch] }\n\n\nvar bob = new WalksTalksFondles('bob', 'hey guys', 100, 'name');\nbob.touch(Object)\nbob.speak(console.log); //bob says: hey guys\nconsole.log(bob);\n//-->\n  { name: 'bob',\n    stride: 100,\n    says: 'hey guys',\n    desires: 'name',\n    felt: 'Object' }\n\nconsole.log(bob.constructor)\n//-->\n  [Function: WalksTalksFondles]\n\n```\n\n\n## Tracer Objects\nThe `tracer` function takes any object and produces an event emitter along with a clone of the object. All interactions with the cloned version will be broadcast from the emitter. The clone can be interacted with in any way as if it were the real object. Any sub-object gotten from the clone through property access, function calling, constructors, etc. will also be a clone that broadcasts to the emitter.\n\n```javascript\nvar emitter = meta.tracer(function Test(){ this.name = 'bob' }, 'Test');\nemitter.on('*', function(event){\n  if (event.property) {\n    console.log(event.type, event.path.join('.'), event.property);\n  } else {\n    console.log(event.type, event.path.join('.'));\n  }\n});\n\nvar Test = emitter.Test;\nvar bob = new Test;\n\nconsole.log(bob);\n//-->\n  construct Test\n  get Test.[[0]] inspect  // instances created via construct are indexed and displayed as [[#]]\n  keys Test.[[0]]\n  describe Test.[[0]] name\n  { name: 'bob' }\n\nbob.stuff = { x: ['a',',b','c'] }\nconsole.log(bob.stuff.x[0]);\n\n//-->\n  set Test.[[0]] stuff\n  get Test.[[0]] stuff\n  get Test.[[0]].stuff x\n  get Test.[[0]].stuff.x 0\n  a\n```\n\n\n## proxy\nA easier to use proxy that's closer to the new Proxy spec than the old one, but with some niceities to make proxy handler creation much simpler. When creating a proxy you provide the object to mirror and the handler. The default action is to forward all actions to the provided target, no traps need be implemented at all.\n```javascript\nvar proxied = meta.proxy(target, handler);\n```\n__Traps__\nSome traps have been renamed because I hate long names. Parameters have been reordered for convenience. The first parameter for all traps is `fwd`, a function that will forward the event to the target. It takes no arguments but has three properties which can be modified. `fwd` can be invoked multiple times, allowing you to, for example, mirror the action against two separate targets.\n\n* __fwd.target__ can be changed to forward the event to something else.\n* __fwd.args__ is an array with the arguments starting after target. For example, to change the property for traps against a specific property, you would do `fwd.args[0] = 'differentProperty'; fwd();`\n* __fwd.trap__ The string name of the trap. Changing this invokes a different forwarding action. For example, in the `keys` trap you could change it to `names` which would then show hidden properties instead of non-hidden ones.\n\n\n```javascript\nkeys      [fwd, target]\nnames     [fwd, target]\nenumerate [fwd, target]\nfix       [fwd, target]\nowns      [fwd, target, prop]\nhas       [fwd, target, prop]\ndelete    [fwd, target, prop]\ndescribe  [fwd, target, prop]\ndefine    [fwd, target, prop, descriptor]\nget       [fwd, target, prop, receiver]\nset       [fwd, target, prop, value, receiver]\napply     [fwd, target, args, receiver]\nconstruct [fwd, target, args]\n```\n\n## membrane\nTakes a proxy handler designed for the above proxy handler api and makes it into a membrane that automatically wraps all outbound objects and unwraps all inbound objects. The handlers only see unwrapped normal objects so it's no more complicated than creating a normal proxy.\n\n## Emitter\nAn object that's cross between DOM events and Node's EventEmitter. Event objects are either used or created which include information about the current target and type of event. Handlers and meta information aren't stored on the emitter itself which allows for separation of the event process and an objects normal operation. An emitter can \"forward\" all event subscriptions from itself to another object such that doing `obj.on('event', callback)` subscribes to events emitted by `obj2`.\n\nThe `this` binding for all callbacks is the emitter of the event, and the first parameter is and `event` object which includes the target of the event. This is usually the same as the emitter, but as in browsers, it may be different. If events are forwarded to another object, or if you're listening to a prototype and getting __all__ events for every instance, the `this` binding will be the object you actually did `emitter.on` to, and the target will be the object responsible for emitting the event.\n\n## WrapMap\nA utility class for simplifying usage of creating wrapper/unwrappers that use WeakMaps. Simply provide a callback function that accepts an input unwrapped object and returns a wrapped version. The result is a `WrapMap` instance with the following functions\n\n* wrap - Wraps objects if they aren't already wrapped. Returns primitives and wrapped objects unmodified.\n* unwrap - Unwraps wrapped objects and returns primitives and unwrapped objects unmodified.\n* wrapDescriptor - Applies the wrapper to `obj.value`, `obj.set`, and `obj.set` but not the base object itself. Modifies the descriptor.\n* unwrapDescriptor - Unwraps `value`, `set`, and `get`. Modifies the descriptor.\n* remove - Unwrap object and remove from the map, returning the unwrapped object.\n* has - Boolean testing if a given object is wrapped.\n\n```javascript\nvar arrayer = new WrapMap(function(obj){\n  return [];\n});\n\nvar test = arrayer.wrap(function test(){});\nconsole.log(test);\n//-->\n  []\n\nconsole.log(arrayer.unwrap(test));\n//-->\n  [Function: test];\n```","maintainers":[{"name":"benvie","email":"brandon@bbenvie.com"}]},"0.2.1":{"author":{"name":"Brandon Benvie","email":"brandon@bbenvie.com","url":"http://bbenvie.com"},"name":"meta-objects","description":"Utilities and patterns for using Harmony Proxies to meta-program. Proxies as Proxy handlers, catch all forwarders for catch all forwarders, intercession introspection. Now you're thinking with portals.","keywords":["harmony","proxy","meta","objects","membrane","ecmascript","functional","partial","weakmap","trace"],"version":"0.2.1","repository":{"url":"https://github.com/Benvie/meta-objects"},"main":"./index.js","engines":{"node":">=0.6.6"},"dependencies":{},"devDependencies":{},"_npmUser":{"name":"benvie","email":"brandon@bbenvie.com"},"_id":"meta-objects@0.2.1","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.15","_nodeVersion":"v0.7.8","_defaultsLoaded":true,"dist":{"shasum":"c9a9e3b933b930b506ffc5d4e32a202c7294f388","tarball":"https://registry.npmjs.org/meta-objects/-/meta-objects-0.2.1.tgz","integrity":"sha512-PbQPP6TYP23im0+j/2U69l28UCVcNv3xFZ7cdLZSx/BJPFGHsgarvlAjrhp2KHOGWnbt+xB0LJxEgHzjX7NmpA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCJOtFVP0oDve1rPCDLr+oD+frJUEx5RPRySNFuz0uQJQIhALQKjbQEvfH10tUdsUQtEPNjXvmNBsSD2Z7DHuTOXSrC"}]},"readme":"# meta-objects\n\nTools for making meta-objects.\n\n* __multiherit__ - Creates a meta class from multiple constructors that combines all of them into one. Prototypal inheritance with multiple prototypes and multiple constructors.\n* __tracer__ - Creates a clone object from the provided object that emits __all__ things that happen to it. It's like databinding on crack.\n* __proxy__ - Simplifies creation of ES6 proxies by handling everything you don't want to and providing ways to forward and subtly modify a target object.\n* __membrane__ - Accepts the same parameters that would be provided to __proxy__ but returns an object that will automatically wrap and unwrap all sub-objects gotten from property access, function calling, constructors, etc.\n* __WrapMap__ - Mostly internal use tool for wrapping/unwrapping objects, used by membranes.\n* __Emitter__ - A cross-between Node's emitters and the DOM event system. Used by tracer.\n\n\n# Install\n\nIt can be used in browsers where Proxy is available or in node. \n\n__Browser__\nThis library works in Firefox 4+ or Chrome 18+ with the `experimental javascript` flag enabled.\n```html\n<script src=\"meta-objects.browser.min.js\"></script>\n<scrript>console.log(meta)</scrript>\n```\n__Node.js__\nThis library works with Node 0.7+ when run like so `node --harmony`.\n```\nnpm install meta-objects\n```\n```javascript\nvar meta = require('meta-objects');\nconsole.log(meta);\n```\n\n## Multiple Inheritance\nThe __multiherit__ function provided allows for simple creation of classes that inherit from multiple objects. That is, you provide a set of constructors (and implicitly the `.prototype` for each) and in return you receive a single constructor with a single prototype. The constructor invokes all of the provided constructors in the order provided. The prototype combines all of the properties of the prototypes, in preference to the order provided.\n\n__multiherit(options)__\n\n* __options.ctors__ is an array of constructors that will be composed. The `prototype` property will be used for determining the list of prototypes.\n* __options.params__(strings) is an array of names that will be used to map params given to the combined ctor to each of the individual ctors. The names are matched to the named parameters of each ctor.\n* __options.params__(number arrays) can be used instead to map the parameters by input order to the matching index ctor.\n* __options.name__ optionally sets a specific name for the resulting Ctor. If not provided it will be made from combining the names of the given ctors.\n* __options.onCall__ optionally make instances callable and provide the function to call when they are called\n* __options.onConstruct__ optionally make instances constructable and provide the constructor function\n\n```javascript\nfunction Talks(name, says){\n  this.name = name;\n  this.says = says;\n}\n\nTalks.prototype = {\n  speak: function speak(at){\n    at(this.name + ' says: ' + this.says);\n  }\n};\n\nfunction Walks(name, stride){\n  this.name = name;\n  this.stride = stride;\n}\n\nWalks.prototype = {\n  move: function move(where){\n    var self = this;\n    setTimeout(function(){\n      where[self.name] = self;\n      self.location = where;\n    }, this.stride);\n  }\n}\n\nfunction Fondles(desires){\n  this.desires = desires;\n}\n\nFondles.prototype = {\n  touch: function touch(who){\n    this.felt = who[this.desires];\n  }\n};\n\n// parameter names are used to map the combined ctor's parameters to the set of constructors\nvar WalksTalksFondles = multiherit({\n  ctors: [Walks, Talks, Fondles],\n  params: ['name', 'says', 'stride', 'desires']\n});\nconsole.log(WalksTalksFondles)\n//-->\n  [Function: WalksTalksFondles]\n\n// the combined prototype can also have its own properties separate from any it inherits\nWalksTalksFondles.prototype.type = 'man';\n\n// the inheritance is dynamic, just like normal [[prototypes]]\nWalks.prototype.speed = 1000;\n\nconsole.log(WalksTalksFondles.prototype)\n//-->\n  { type: 'man',\n    move: [Function: move],\n    speed: 1000,\n    speak: [Function: speak],\n    touch: [Function: touch] }\n\n\nvar bob = new WalksTalksFondles('bob', 'hey guys', 100, 'name');\nbob.touch(Object)\nbob.speak(console.log); //bob says: hey guys\nconsole.log(bob);\n//-->\n  { name: 'bob',\n    stride: 100,\n    says: 'hey guys',\n    desires: 'name',\n    felt: 'Object' }\n\nconsole.log(bob.constructor)\n//-->\n  [Function: WalksTalksFondles]\n\n```\n\n\n## Tracer Objects\nThe `tracer` function takes any object and produces an event emitter along with a clone of the object. All interactions with the cloned version will be broadcast from the emitter. The clone can be interacted with in any way as if it were the real object. Any sub-object gotten from the clone through property access, function calling, constructors, etc. will also be a clone that broadcasts to the emitter.\n\n```javascript\nvar emitter = meta.tracer(function Test(){ this.name = 'bob' }, 'Test');\nemitter.on('*', function(event){\n  if (event.property) {\n    console.log(event.type, event.path.join('.'), event.property);\n  } else {\n    console.log(event.type, event.path.join('.'));\n  }\n});\n\nvar Test = emitter.Test;\nvar bob = new Test;\n\nconsole.log(bob);\n//-->\n  construct Test\n  get Test.[[0]] inspect  // instances created via construct are indexed and displayed as [[#]]\n  keys Test.[[0]]\n  describe Test.[[0]] name\n  { name: 'bob' }\n\nbob.stuff = { x: ['a',',b','c'] }\nconsole.log(bob.stuff.x[0]);\n\n//-->\n  set Test.[[0]] stuff\n  get Test.[[0]] stuff\n  get Test.[[0]].stuff x\n  get Test.[[0]].stuff.x 0\n  a\n```\n\n\n## proxy\nA easier to use proxy that's closer to the new Proxy spec than the old one, but with some niceities to make proxy handler creation much simpler. When creating a proxy you provide the object to mirror and the handler. The default action is to forward all actions to the provided target, no traps need be implemented at all.\n```javascript\nvar proxied = meta.proxy(target, handler);\n```\n__Traps__\nSome traps have been renamed because I hate long names. Parameters have been reordered for convenience. The first parameter for all traps is `fwd`, a function that will forward the event to the target. It takes no arguments but has three properties which can be modified. `fwd` can be invoked multiple times, allowing you to, for example, mirror the action against two separate targets.\n\n* __fwd.target__ can be changed to forward the event to something else.\n* __fwd.args__ is an array with the arguments starting after target. For example, to change the property for traps against a specific property, you would do `fwd.args[0] = 'differentProperty'; fwd();`\n* __fwd.trap__ The string name of the trap. Changing this invokes a different forwarding action. For example, in the `keys` trap you could change it to `names` which would then show hidden properties instead of non-hidden ones.\n\n\n```javascript\nkeys      [fwd, target]\nnames     [fwd, target]\nenumerate [fwd, target]\nfix       [fwd, target]\nowns      [fwd, target, prop]\nhas       [fwd, target, prop]\ndelete    [fwd, target, prop]\ndescribe  [fwd, target, prop]\ndefine    [fwd, target, prop, descriptor]\nget       [fwd, target, prop, receiver]\nset       [fwd, target, prop, value, receiver]\napply     [fwd, target, args, receiver]\nconstruct [fwd, target, args]\n```\n\n## membrane\nTakes a proxy handler designed for the above proxy handler api and makes it into a membrane that automatically wraps all outbound objects and unwraps all inbound objects. The handlers only see unwrapped normal objects so it's no more complicated than creating a normal proxy.\n\n## Emitter\nAn object that's cross between DOM events and Node's EventEmitter. Event objects are either used or created which include information about the current target and type of event. Handlers and meta information aren't stored on the emitter itself which allows for separation of the event process and an objects normal operation. An emitter can \"forward\" all event subscriptions from itself to another object such that doing `obj.on('event', callback)` subscribes to events emitted by `obj2`.\n\nThe `this` binding for all callbacks is the emitter of the event, and the first parameter is and `event` object which includes the target of the event. This is usually the same as the emitter, but as in browsers, it may be different. If events are forwarded to another object, or if you're listening to a prototype and getting __all__ events for every instance, the `this` binding will be the object you actually did `emitter.on` to, and the target will be the object responsible for emitting the event.\n\n## WrapMap\nA utility class for simplifying usage of creating wrapper/unwrappers that use WeakMaps. Simply provide a callback function that accepts an input unwrapped object and returns a wrapped version. The result is a `WrapMap` instance with the following functions\n\n* wrap - Wraps objects if they aren't already wrapped. Returns primitives and wrapped objects unmodified.\n* unwrap - Unwraps wrapped objects and returns primitives and unwrapped objects unmodified.\n* wrapDescriptor - Applies the wrapper to `obj.value`, `obj.set`, and `obj.set` but not the base object itself. Modifies the descriptor.\n* unwrapDescriptor - Unwraps `value`, `set`, and `get`. Modifies the descriptor.\n* remove - Unwrap object and remove from the map, returning the unwrapped object.\n* has - Boolean testing if a given object is wrapped.\n\n```javascript\nvar arrayer = new WrapMap(function(obj){\n  return [];\n});\n\nvar test = arrayer.wrap(function test(){});\nconsole.log(test);\n//-->\n  []\n\nconsole.log(arrayer.unwrap(test));\n//-->\n  [Function: test];\n```","maintainers":[{"name":"benvie","email":"brandon@bbenvie.com"}]},"0.2.3":{"author":{"name":"Brandon Benvie","email":"brandon@bbenvie.com","url":"http://bbenvie.com"},"name":"meta-objects","description":"Utilities and patterns for using Harmony Proxies to meta-program. Proxies as Proxy handlers, catch all forwarders for catch all forwarders, intercession introspection. Now you're thinking with portals.","keywords":["harmony","proxy","meta","objects","membrane","ecmascript","functional","partial","weakmap","trace"],"version":"0.2.3","repository":{"url":"https://github.com/Benvie/meta-objects"},"main":"./index.js","engines":{"node":">=0.6.6"},"dependencies":{},"devDependencies":{},"_npmUser":{"name":"benvie","email":"brandon@bbenvie.com"},"_id":"meta-objects@0.2.3","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.18","_nodeVersion":"v0.7.8","_defaultsLoaded":true,"dist":{"shasum":"d02ae3119b2d2b57b13609d85109e774088b74d5","tarball":"https://registry.npmjs.org/meta-objects/-/meta-objects-0.2.3.tgz","integrity":"sha512-D0vBO6gDq6irYu06Yvee2GCzm0i2teI9qGWOkzojY/taw5ber/W4WA97/bVAcPW5f81/vfmtXCRBq6N8cRPJpQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH7PSlyZzeZ/IVFU9bH0wXXSZAh2H8nOjbS/GuBUUKqzAiAdD9QYY3hdO5dBVbTE/7MjgRHBk/k9dLzjRAoZqSkG+g=="}]},"readme":"# Meta-Objects\n\nTools for making meta-objects.\n\n* __callable__ - Takes an object and returns a callable and constructable version of it, which use the __$$call__ and __$$construct__ properties on the object.\n* __multiherit__ - Creates a meta class from multiple constructors that combines all of them into one. Prototypal inheritance with multiple prototypes and multiple constructors.\n* __tracer__ - Creates a clone object from the provided object that emits __all__ things that happen to it. It's like databinding on crack.\n* __proxy__ - Simplifies creation of ES6 proxies by handling everything you don't want to and providing ways to forward and subtly modify a target object.\n* __membrane__ - Accepts the same parameters that would be provided to __proxy__ but returns an object that will automatically wrap and unwrap all sub-objects gotten from property access, function calling, constructors, etc.\n* __WrapMap__ - Mostly internal use tool for wrapping/unwrapping objects, used by membranes.\n* __Emitter__ - A cross-between Node's emitters and the DOM event system. Used by tracer.\n\n\n# Install\n\n__This library relies on features from the next version of ECMAScript and isn't going to work in most environments.__\n\n`WeakMap` and `Proxy` are required. This library works in:\n\n* Firefox 4+\n* Chrome 18+ with the `experimental javascript` flag enabled\n* Node 0.7+ when run like so `node --harmony`\n\n__Browser__\n```html\n<script src=\"meta-objects.browser.min.js\"></script>\n<scrript>console.log(meta)</scrript>\n```\n\n__Node.js__\n```\nnpm install meta-objects\n```\n```javascript\nvar meta = require('meta-objects');\nconsole.log(meta);\n```\n\n## Callable Objects\nA simple to use function that takes an object and returns a mirror of it that is callable and constructable. All changes to one reflect the other so they are in effect the same object, except the returned version is a function and they are not `===`.\n\n__callable(obj)__\n\n* __obj.$$call__ - If present, this function will be called when the callable object is in any manner. `obj()` or `obj.call(x, args...)`. `this` is bound to the object itself so using call, bind, or apply won't have any effect on `this`.\n* __obj.$$construct__ - If preset, this function will be called whenever the object is constructed using `new obj(...args)`. `this` will be a newly created object as if created using `Object.create(obj)` but it will also be callable and not just an object.\n\nIf `obj.$$call` is not present then the call will simply do nothing. If `obj.$$construct` is not present, then the newly created callable child of the object will be returned as is, so it's still useful for creating new instances without any constructor logic.\n\n`obj.$$call` and `obj.$$construct` are completely invisible properties but (currently) are still gettable and settable. It's likely this will be changed so there's some specific procedure for assessing these essentially private properties.\n\n\n```javascript\nvar obj = {\n  y: 10,\n  $$call: function(){\n    return this.y++;\n  }\n};\nvar cobj = callable(obj);\n\nconsole.log(obj);\n//-->\n  { y: 10, $$call: [Function] }\n\nconsole.log(cobj);\n//-->\n  { [Function] y: 10 }\n\ncobj();\nconsole.log(cobj);\n//-->\n  { [Function] y: 11 }\n```\n\n## Multiple Inheritance\nThe __multiherit__ function provided allows for simple creation of classes that inherit from multiple objects. That is, you provide a set of constructors (and implicitly the `.prototype` for each) and in return you receive a single constructor with a single prototype. The constructor invokes all of the provided constructors in the order provided. The prototype combines all of the properties of the prototypes, in preference to the order provided.\n\n__multiherit(options)__\n\n* __options.ctors__ is an array of constructors that will be composed. The `prototype` property will be used for determining the list of prototypes.\n* __options.params__(strings) is an array of names that will be used to map params given to the combined ctor to each of the individual ctors. The names are matched to the named parameters of each ctor.\n* __options.params__(number arrays) can be used instead to map the parameters by input order to the matching index ctor.\n* __options.name__ optionally sets a specific name for the resulting Ctor. If not provided it will be made from combining the names of the given ctors.\n* __options.onCall__ optionally make instances callable and provide the function to call when they are called\n* __options.onConstruct__ optionally make instances constructable and provide the constructor function\n\n```javascript\nfunction Talks(name, says){\n  this.name = name;\n  this.says = says;\n}\n\nTalks.prototype = {\n  speak: function speak(at){\n    at(this.name + ' says: ' + this.says);\n  }\n};\n\nfunction Walks(name, stride){\n  this.name = name;\n  this.stride = stride;\n}\n\nWalks.prototype = {\n  move: function move(where){\n    var self = this;\n    setTimeout(function(){\n      where[self.name] = self;\n      self.location = where;\n    }, this.stride);\n  }\n}\n\nfunction Fondles(desires){\n  this.desires = desires;\n}\n\nFondles.prototype = {\n  touch: function touch(who){\n    this.felt = who[this.desires];\n  }\n};\n\n// parameter names are used to map the combined ctor's parameters to the set of constructors\nvar WalksTalksFondles = multiherit({\n  ctors: [Walks, Talks, Fondles],\n  params: ['name', 'says', 'stride', 'desires']\n});\nconsole.log(WalksTalksFondles)\n//-->\n  [Function: WalksTalksFondles]\n\n// the combined prototype can also have its own properties separate from any it inherits\nWalksTalksFondles.prototype.type = 'man';\n\n// the inheritance is dynamic, just like normal [[prototypes]]\nWalks.prototype.speed = 1000;\n\nconsole.log(WalksTalksFondles.prototype)\n//-->\n  { type: 'man',\n    move: [Function: move],\n    speed: 1000,\n    speak: [Function: speak],\n    touch: [Function: touch] }\n\n\nvar bob = new WalksTalksFondles('bob', 'hey guys', 100, 'name');\nbob.touch(Object)\nbob.speak(console.log); //bob says: hey guys\nconsole.log(bob);\n//-->\n  { name: 'bob',\n    stride: 100,\n    says: 'hey guys',\n    desires: 'name',\n    felt: 'Object' }\n\nconsole.log(bob.constructor)\n//-->\n  [Function: WalksTalksFondles]\n\n```\n\n\n## Tracer Objects\nThe `tracer` function takes any object and produces an event emitter along with a clone of the object. All interactions with the cloned version will be broadcast from the emitter. The clone can be interacted with in any way as if it were the real object. Any sub-object gotten from the clone through property access, function calling, constructors, etc. will also be a clone that broadcasts to the emitter.\n\n```javascript\nvar emitter = meta.tracer(function Test(){ this.name = 'bob' }, 'Test');\nemitter.on('*', function(event){\n  if (event.property) {\n    console.log(event.type, event.path.join('.'), event.property);\n  } else {\n    console.log(event.type, event.path.join('.'));\n  }\n});\n\nvar Test = emitter.Test;\nvar bob = new Test;\n\nconsole.log(bob);\n//-->\n  construct Test\n  get Test.[[0]] inspect  // instances created via construct are indexed and displayed as [[#]]\n  keys Test.[[0]]\n  describe Test.[[0]] name\n  { name: 'bob' }\n\nbob.stuff = { x: ['a',',b','c'] }\nconsole.log(bob.stuff.x[0]);\n\n//-->\n  set Test.[[0]] stuff\n  get Test.[[0]] stuff\n  get Test.[[0]].stuff x\n  get Test.[[0]].stuff.x 0\n  a\n```\n\n\n## proxy\nA easier to use proxy that's closer to the new Proxy spec than the old one, but with some niceities to make proxy handler creation much simpler. When creating a proxy you provide the object to mirror and the handler. The default action is to forward all actions to the provided target, no traps need be implemented at all.\n```javascript\nvar proxied = meta.proxy(target, handler);\n```\n__Traps__\nSome traps have been renamed because I hate long names. Parameters have been reordered for convenience. The first parameter for all traps is `fwd`, a function that will forward the event to the target. It takes no arguments but has three properties which can be modified. `fwd` can be invoked multiple times, allowing you to, for example, mirror the action against two separate targets.\n\n* __fwd.target__ can be changed to forward the event to something else.\n* __fwd.args__ is an array with the arguments starting after target. For example, to change the property for traps against a specific property, you would do `fwd.args[0] = 'differentProperty'; fwd();`\n* __fwd.trap__ The string name of the trap. Changing this invokes a different forwarding action. For example, in the `keys` trap you could change it to `names` which would then show hidden properties instead of non-hidden ones.\n\n\n```javascript\nkeys      [fwd, target]\nnames     [fwd, target]\nenumerate [fwd, target]\nfix       [fwd, target]\nowns      [fwd, target, prop]\nhas       [fwd, target, prop]\ndelete    [fwd, target, prop]\ndescribe  [fwd, target, prop]\ndefine    [fwd, target, prop, descriptor]\nget       [fwd, target, prop, receiver]\nset       [fwd, target, prop, value, receiver]\napply     [fwd, target, args, receiver]\nconstruct [fwd, target, args]\n```\n\n## membrane\nTakes a proxy handler designed for the above proxy handler api and makes it into a membrane that automatically wraps all outbound objects and unwraps all inbound objects. The handlers only see unwrapped normal objects so it's no more complicated than creating a normal proxy.\n\n## Emitter\nAn object that's cross between DOM events and Node's EventEmitter. Event objects are either used or created which include information about the current target and type of event. Handlers and meta information aren't stored on the emitter itself which allows for separation of the event process and an objects normal operation. An emitter can \"forward\" all event subscriptions from itself to another object such that doing `obj.on('event', callback)` subscribes to events emitted by `obj2`.\n\nThe `this` binding for all callbacks is the emitter of the event, and the first parameter is and `event` object which includes the target of the event. This is usually the same as the emitter, but in some cases it may be different. If events are forwarded to another object, or if you're listening to a prototype and getting __all__ events for every instance inheriting from it, the `this` binding will be the object you registered with using `emitter.on`, and the target will be the object responsible for emitting the event. This is similar to how most DOM frameworks work with event delegation and dispatching.\n\n## WrapMap\nA utility class for simplifying usage of creating wrapper/unwrappers that use WeakMaps. Simply provide a callback function that accepts an input unwrapped object and returns a wrapped version. The result is a `WrapMap` instance with the following functions\n\n* wrap - Wraps objects if they aren't already wrapped. Returns primitives and wrapped objects unmodified.\n* unwrap - Unwraps wrapped objects and returns primitives and unwrapped objects unmodified.\n* wrapDescriptor - Applies the wrapper to `obj.value`, `obj.set`, and `obj.set` but not the base object itself. Modifies the descriptor.\n* unwrapDescriptor - Unwraps `value`, `set`, and `get`. Modifies the descriptor.\n* remove - Unwrap object and remove from the map, returning the unwrapped object.\n* has - Boolean testing if a given object is wrapped.\n\n```javascript\nvar arrayer = new WrapMap(function(obj){\n  return [];\n});\n\nvar test = arrayer.wrap(function test(){});\nconsole.log(test);\n//-->\n  []\n\nconsole.log(arrayer.unwrap(test));\n//-->\n  [Function: test];\n```","maintainers":[{"name":"benvie","email":"brandon@bbenvie.com"}]},"0.2.5":{"author":{"name":"Brandon Benvie","email":"brandon@bbenvie.com","url":"http://bbenvie.com"},"name":"meta-objects","description":"Utilities and patterns for using Harmony Proxies to meta-program. Proxies as Proxy handlers, catch all forwarders for catch all forwarders, intercession introspection. Now you're thinking with portals.","keywords":["harmony","proxy","meta","objects","membrane","ecmascript","functional","partial","weakmap","trace"],"version":"0.2.5","repository":{"url":"https://github.com/Benvie/meta-objects"},"main":"./index.js","engines":{"node":">=0.6.6"},"dependencies":{},"devDependencies":{},"_npmUser":{"name":"benvie","email":"brandon@bbenvie.com"},"_id":"meta-objects@0.2.5","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.18","_nodeVersion":"v0.7.8","_defaultsLoaded":true,"dist":{"shasum":"dfc1aa58a24d829c1062c9ad10fa692db5165fd3","tarball":"https://registry.npmjs.org/meta-objects/-/meta-objects-0.2.5.tgz","integrity":"sha512-CygPriCivsLMbgNZYWlbPJDQH9KD7VAVALUCm2k7LkJ/0q1YrVqMJ7SwTxkE2gOVYRp2GhcDlw6yntJT7ZNJ+g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHxp24fSIiGOSCLhTGUsetpHiZ05JIIPY8dN0lAsfhNJAiAH3VRTp58bs8ys4+r7P7T4mdnWSo1jAme/6rOb/x6dXg=="}]},"readme":"# Meta-Objects\n\nTools for making meta-objects.\n\n* __callable__ - Takes an object and returns a callable and constructable version of it, which use the __$$call__ and __$$construct__ properties on the object.\n* __multiherit__ - Creates a meta class from multiple constructors that combines all of them into one. Prototypal inheritance with multiple prototypes and multiple constructors.\n* __tracer__ - Creates a clone object from the provided object that emits __all__ things that happen to it. It's like databinding on crack.\n* __proxy__ - Simplifies creation of ES6 proxies by handling everything you don't want to and providing ways to forward and subtly modify a target object.\n* __membrane__ - Accepts the same parameters that would be provided to __proxy__ but returns an object that will automatically wrap and unwrap all sub-objects gotten from property access, function calling, constructors, etc.\n* __WrapMap__ - Mostly internal use tool for wrapping/unwrapping objects, used by membranes.\n* __Emitter__ - A cross-between Node's emitters and the DOM event system. Used by tracer.\n\n\n# Install\n\n__This library relies on features from the next version of ECMAScript and isn't going to work in most environments.__\n\n`WeakMap` and `Proxy` are required. This library works in:\n\n* Firefox 4+\n* Chrome 18+ with the `experimental javascript` flag enabled\n* Node 0.7+ when run like so `node --harmony`\n\n__Browser__\n```html\n<script src=\"meta-objects.browser.min.js\"></script>\n<scrript>console.log(meta)</scrript>\n```\n\n__Node.js__\n```\nnpm install meta-objects\n```\n```javascript\nvar meta = require('meta-objects');\nconsole.log(meta);\n```\n\n## Callable Objects\nA simple to use function that takes an object and returns a mirror of it that is callable and constructable. All changes to one reflect the other so they are in effect the same object, except the returned version is a function and they are not `===`.\n\n__callable(obj)__\n\n* __obj.$$call__ - If present, this function will be called when the callable object is in any manner. `obj()` or `obj.call(x, args...)`. `this` is bound to the object itself so using call, bind, or apply won't have any effect on `this`.\n* __obj.$$construct__ - If preset, this function will be called whenever the object is constructed using `new obj(...args)`. `this` will be a newly created object as if created using `Object.create(obj)` but it will also be callable and not just an object.\n\nIf `obj.$$call` is not present then the call will simply do nothing. If `obj.$$construct` is not present, then the newly created callable child of the object will be returned as is, so it's still useful for creating new instances without any constructor logic.\n\n`obj.$$call` and `obj.$$construct` are completely invisible properties but (currently) are still gettable and settable. It's likely this will be changed so there's some specific procedure for assessing these essentially private properties.\n\n\n```javascript\nvar obj = {\n  y: 10,\n  $$call: function(){\n    return this.y++;\n  }\n};\nvar cobj = callable(obj);\n\nconsole.log(obj);\n//-->\n  { y: 10, $$call: [Function] }\n\nconsole.log(cobj);\n//-->\n  { [Function] y: 10 }\n\ncobj();\nconsole.log(cobj);\n//-->\n  { [Function] y: 11 }\n```\n\n## Multiple Inheritance\nThe __multiherit__ function provided allows for simple creation of classes that inherit from multiple objects. That is, you provide a set of constructors (and implicitly the `.prototype` for each) and in return you receive a single constructor with a single prototype. The constructor invokes all of the provided constructors in the order provided. The prototype combines all of the properties of the prototypes, in preference to the order provided.\n\n__multiherit(options)__\n\n* __options.ctors__ is an array of constructors that will be composed. The `prototype` property will be used for determining the list of prototypes.\n* __options.params__(strings) is an array of names that will be used to map params given to the combined ctor to each of the individual ctors. The names are matched to the named parameters of each ctor.\n* __options.params__(number arrays) can be used instead to map the parameters by input order to the matching index ctor.\n* __options.name__ optionally sets a specific name for the resulting Ctor. If not provided it will be made from combining the names of the given ctors.\n* __options.onCall__ optionally make instances callable and provide the function to call when they are called\n* __options.onConstruct__ optionally make instances constructable and provide the constructor function\n\n```javascript\nfunction Talks(name, says){\n  this.name = name;\n  this.says = says;\n}\n\nTalks.prototype = {\n  speak: function speak(at){\n    at(this.name + ' says: ' + this.says);\n  }\n};\n\nfunction Walks(name, stride){\n  this.name = name;\n  this.stride = stride;\n}\n\nWalks.prototype = {\n  move: function move(where){\n    var self = this;\n    setTimeout(function(){\n      where[self.name] = self;\n      self.location = where;\n    }, this.stride);\n  }\n}\n\nfunction Fondles(desires){\n  this.desires = desires;\n}\n\nFondles.prototype = {\n  touch: function touch(who){\n    this.felt = who[this.desires];\n  }\n};\n\n// parameter names are used to map the combined ctor's parameters to the set of constructors\nvar WalksTalksFondles = multiherit({\n  ctors: [Walks, Talks, Fondles],\n  params: ['name', 'says', 'stride', 'desires']\n});\nconsole.log(WalksTalksFondles)\n//-->\n  [Function: WalksTalksFondles]\n\n// the combined prototype can also have its own properties separate from any it inherits\nWalksTalksFondles.prototype.type = 'man';\n\n// the inheritance is dynamic, just like normal [[prototypes]]\nWalks.prototype.speed = 1000;\n\nconsole.log(WalksTalksFondles.prototype)\n//-->\n  { type: 'man',\n    move: [Function: move],\n    speed: 1000,\n    speak: [Function: speak],\n    touch: [Function: touch] }\n\n\nvar bob = new WalksTalksFondles('bob', 'hey guys', 100, 'name');\nbob.touch(Object)\nbob.speak(console.log); //bob says: hey guys\nconsole.log(bob);\n//-->\n  { name: 'bob',\n    stride: 100,\n    says: 'hey guys',\n    desires: 'name',\n    felt: 'Object' }\n\nconsole.log(bob.constructor)\n//-->\n  [Function: WalksTalksFondles]\n\n```\n\n\n## Tracer Objects\nThe `tracer` function takes any object and produces an event emitter along with a clone of the object. All interactions with the cloned version will be broadcast from the emitter. The clone can be interacted with in any way as if it were the real object. Any sub-object gotten from the clone through property access, function calling, constructors, etc. will also be a clone that broadcasts to the emitter.\n\n```javascript\nvar emitter = meta.tracer(function Test(){ this.name = 'bob' }, 'Test');\nemitter.on('*', function(event){\n  if (event.property) {\n    console.log(event.type, event.path.join('.'), event.property);\n  } else {\n    console.log(event.type, event.path.join('.'));\n  }\n});\n\nvar Test = emitter.Test;\nvar bob = new Test;\n\nconsole.log(bob);\n//-->\n  construct Test\n  get Test.[[0]] inspect  // instances created via construct are indexed and displayed as [[#]]\n  keys Test.[[0]]\n  describe Test.[[0]] name\n  { name: 'bob' }\n\nbob.stuff = { x: ['a',',b','c'] }\nconsole.log(bob.stuff.x[0]);\n\n//-->\n  set Test.[[0]] stuff\n  get Test.[[0]] stuff\n  get Test.[[0]].stuff x\n  get Test.[[0]].stuff.x 0\n  a\n```\n\n\n## proxy\nA easier to use proxy that's closer to the new Proxy spec than the old one, but with some niceities to make proxy handler creation much simpler. When creating a proxy you provide the object to mirror and the handler. The default action is to forward all actions to the provided target, no traps need be implemented at all.\n```javascript\nvar proxied = meta.proxy(target, handler);\n```\n__Traps__\nSome traps have been renamed because I hate long names. Parameters have been reordered for convenience. The first parameter for all traps is `fwd`, a function that will forward the event to the target. It takes no arguments but has three properties which can be modified. `fwd` can be invoked multiple times, allowing you to, for example, mirror the action against two separate targets.\n\n* __fwd.target__ can be changed to forward the event to something else.\n* __fwd.args__ is an array with the arguments starting after target. For example, to change the property for traps against a specific property, you would do `fwd.args[0] = 'differentProperty'; fwd();`\n* __fwd.trap__ The string name of the trap. Changing this invokes a different forwarding action. For example, in the `keys` trap you could change it to `names` which would then show hidden properties instead of non-hidden ones.\n\n\n```javascript\nkeys      [fwd, target]\nnames     [fwd, target]\nenumerate [fwd, target]\nfix       [fwd, target]\nowns      [fwd, target, prop]\nhas       [fwd, target, prop]\ndelete    [fwd, target, prop]\ndescribe  [fwd, target, prop]\ndefine    [fwd, target, prop, descriptor]\nget       [fwd, target, prop, receiver]\nset       [fwd, target, prop, value, receiver]\napply     [fwd, target, args, receiver]\nconstruct [fwd, target, args]\n```\n\n## membrane\nTakes a proxy handler designed for the above proxy handler api and makes it into a membrane that automatically wraps all outbound objects and unwraps all inbound objects. The handlers only see unwrapped normal objects so it's no more complicated than creating a normal proxy.\n\n## Emitter\nAn object that's cross between DOM events and Node's EventEmitter. Event objects are either used or created which include information about the current target and type of event. Handlers and meta information aren't stored on the emitter itself which allows for separation of the event process and an objects normal operation. An emitter can \"forward\" all event subscriptions from itself to another object such that doing `obj.on('event', callback)` subscribes to events emitted by `obj2`.\n\nThe `this` binding for all callbacks is the emitter of the event, and the first parameter is and `event` object which includes the target of the event. This is usually the same as the emitter, but in some cases it may be different. If events are forwarded to another object, or if you're listening to a prototype and getting __all__ events for every instance inheriting from it, the `this` binding will be the object you registered with using `emitter.on`, and the target will be the object responsible for emitting the event. This is similar to how most DOM frameworks work with event delegation and dispatching.\n\n## WrapMap\nA utility class for simplifying usage of creating wrapper/unwrappers that use WeakMaps. Simply provide a callback function that accepts an input unwrapped object and returns a wrapped version. The result is a `WrapMap` instance with the following functions\n\n* wrap - Wraps objects if they aren't already wrapped. Returns primitives and wrapped objects unmodified.\n* unwrap - Unwraps wrapped objects and returns primitives and unwrapped objects unmodified.\n* wrapDescriptor - Applies the wrapper to `obj.value`, `obj.set`, and `obj.set` but not the base object itself. Modifies the descriptor.\n* unwrapDescriptor - Unwraps `value`, `set`, and `get`. Modifies the descriptor.\n* remove - Unwrap object and remove from the map, returning the unwrapped object.\n* has - Boolean testing if a given object is wrapped.\n\n```javascript\nvar arrayer = new WrapMap(function(obj){\n  return [];\n});\n\nvar test = arrayer.wrap(function test(){});\nconsole.log(test);\n//-->\n  []\n\nconsole.log(arrayer.unwrap(test));\n//-->\n  [Function: test];\n```","maintainers":[{"name":"benvie","email":"brandon@bbenvie.com"}]},"0.2.6":{"author":{"name":"Brandon Benvie","email":"brandon@bbenvie.com","url":"http://bbenvie.com"},"name":"meta-objects","description":"Utilities and patterns for using Harmony Proxies to meta-program. Proxies as Proxy handlers, catch all forwarders for catch all forwarders, intercession introspection. Now you're thinking with portals.","keywords":["harmony","proxy","meta","objects","membrane","ecmascript","functional","partial","weakmap","trace"],"version":"0.2.6","repository":{"url":"https://github.com/Benvie/meta-objects"},"main":"./index.js","engines":{"node":">=0.6.6"},"dependencies":{},"devDependencies":{},"_npmUser":{"name":"benvie","email":"brandon@bbenvie.com"},"_id":"meta-objects@0.2.6","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.18","_nodeVersion":"v0.7.8","_defaultsLoaded":true,"dist":{"shasum":"d9d84beb651719ecf9d8856c575bc8066bde65d7","tarball":"https://registry.npmjs.org/meta-objects/-/meta-objects-0.2.6.tgz","integrity":"sha512-IMAL4H6HibO+6DAQXc0mKuHIVbFb2UbQkZEb0ww2Q2dDGKZz8lj0O8b+EfofQp+NaDVSTreVZrzZV3YHfx54/w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIE/iW0DvGheGXdcHIITPXmmiRKtWZoDTYWG+TagKl4NzAiBRvvhSPJW34XB7Cf/xqoS12RHCiPgt4Hkq3WGX5PI11Q=="}]},"readme":"# Meta-Objects\n\nTools for making meta-objects.\n\n* __callable__ - Takes an object and returns a callable and constructable version of it, which use the __$$call__ and __$$construct__ properties on the object.\n* __multiherit__ - Creates a meta class from multiple constructors that combines all of them into one. Prototypal inheritance with multiple prototypes and multiple constructors.\n* __tracer__ - Creates a clone object from the provided object that emits __all__ things that happen to it. It's like databinding on crack.\n* __proxy__ - Simplifies creation of ES6 proxies by handling everything you don't want to and providing ways to forward and subtly modify a target object.\n* __membrane__ - Accepts the same parameters that would be provided to __proxy__ but returns an object that will automatically wrap and unwrap all sub-objects gotten from property access, function calling, constructors, etc.\n* __WrapMap__ - Mostly internal use tool for wrapping/unwrapping objects, used by membranes.\n* __Emitter__ - A cross-between Node's emitters and the DOM event system. Used by tracer.\n\n\n# Install\n\n__This library relies on features from the next version of ECMAScript and isn't going to work in most environments.__\n\n`WeakMap` and `Proxy` are required. This library works in:\n\n* Firefox 4+\n* Chrome 18+ with the `experimental javascript` flag enabled\n* Node 0.7+ when run like so `node --harmony`\n\n__Browser__\n```html\n<script src=\"meta-objects.browser.min.js\"></script>\n<scrript>console.log(meta)</scrript>\n```\n\n__Node.js__\n```\nnpm install meta-objects\n```\n```javascript\nvar meta = require('meta-objects');\nconsole.log(meta);\n```\n\n## Callable Objects\nA simple to use function that takes an object and returns a mirror of it that is callable and constructable. All changes to one reflect the other so they are in effect the same object, except the returned version is a function and they are not `===`.\n\n__callable(obj)__\n\n* __obj.$$call__ - If present, this function will be called when the callable object is in any manner. `obj()` or `obj.call(x, args...)`. `this` is bound to the object itself so using call, bind, or apply won't have any effect on `this`.\n* __obj.$$construct__ - If preset, this function will be called whenever the object is constructed using `new obj(...args)`. `this` will be a newly created object as if created using `Object.create(obj)` but it will also be callable and not just an object.\n\nIf `obj.$$call` is not present then the call will simply do nothing. If `obj.$$construct` is not present, then the newly created callable child of the object will be returned as is, so it's still useful for creating new instances without any constructor logic.\n\n`obj.$$call` and `obj.$$construct` are completely invisible properties but (currently) are still gettable and settable. It's likely this will be changed so there's some specific procedure for assessing these essentially private properties.\n\n\n```javascript\nvar obj = {\n  y: 10,\n  $$call: function(){\n    return this.y++;\n  }\n};\nvar cobj = callable(obj);\n\nconsole.log(obj);\n//-->\n  { y: 10, $$call: [Function] }\n\nconsole.log(cobj);\n//-->\n  { [Function] y: 10 }\n\ncobj();\nconsole.log(cobj);\n//-->\n  { [Function] y: 11 }\n```\n\n## Multiple Inheritance\nThe __multiherit__ function provided allows for simple creation of classes that inherit from multiple objects. That is, you provide a set of constructors (and implicitly the `.prototype` for each) and in return you receive a single constructor with a single prototype. The constructor invokes all of the provided constructors in the order provided. The prototype combines all of the properties of the prototypes, in preference to the order provided.\n\n__multiherit(options)__\n\n* __options.ctors__ is an array of constructors that will be composed. The `prototype` property will be used for determining the list of prototypes.\n* __options.params__(strings) is an array of names that will be used to map params given to the combined ctor to each of the individual ctors. The names are matched to the named parameters of each ctor.\n* __options.params__(number arrays) can be used instead to map the parameters by input order to the matching index ctor.\n* __options.name__ optionally sets a specific name for the resulting Ctor. If not provided it will be made from combining the names of the given ctors.\n* __options.onCall__ optionally make instances callable and provide the function to call when they are called\n* __options.onConstruct__ optionally make instances constructable and provide the constructor function\n\n```javascript\nfunction Talks(name, says){\n  this.name = name;\n  this.says = says;\n}\n\nTalks.prototype = {\n  speak: function speak(at){\n    at(this.name + ' says: ' + this.says);\n  }\n};\n\nfunction Walks(name, stride){\n  this.name = name;\n  this.stride = stride;\n}\n\nWalks.prototype = {\n  move: function move(where){\n    var self = this;\n    setTimeout(function(){\n      where[self.name] = self;\n      self.location = where;\n    }, this.stride);\n  }\n}\n\nfunction Fondles(desires){\n  this.desires = desires;\n}\n\nFondles.prototype = {\n  touch: function touch(who){\n    this.felt = who[this.desires];\n  }\n};\n\n// parameter names are used to map the combined ctor's parameters to the set of constructors\nvar WalksTalksFondles = multiherit({\n  ctors: [Walks, Talks, Fondles],\n  params: ['name', 'says', 'stride', 'desires']\n});\nconsole.log(WalksTalksFondles)\n//-->\n  [Function: WalksTalksFondles]\n\n// the combined prototype can also have its own properties separate from any it inherits\nWalksTalksFondles.prototype.type = 'man';\n\n// the inheritance is dynamic, just like normal [[prototypes]]\nWalks.prototype.speed = 1000;\n\nconsole.log(WalksTalksFondles.prototype)\n//-->\n  { type: 'man',\n    move: [Function: move],\n    speed: 1000,\n    speak: [Function: speak],\n    touch: [Function: touch] }\n\n\nvar bob = new WalksTalksFondles('bob', 'hey guys', 100, 'name');\nbob.touch(Object)\nbob.speak(console.log); //bob says: hey guys\nconsole.log(bob);\n//-->\n  { name: 'bob',\n    stride: 100,\n    says: 'hey guys',\n    desires: 'name',\n    felt: 'Object' }\n\nconsole.log(bob.constructor)\n//-->\n  [Function: WalksTalksFondles]\n\n```\n\n\n## Tracer Objects\nThe `tracer` function takes any object and produces an event emitter along with a clone of the object. All interactions with the cloned version will be broadcast from the emitter. The clone can be interacted with in any way as if it were the real object. Any sub-object gotten from the clone through property access, function calling, constructors, etc. will also be a clone that broadcasts to the emitter.\n\n```javascript\nvar emitter = meta.tracer(function Test(){ this.name = 'bob' }, 'Test');\nemitter.on('*', function(event){\n  if (event.property) {\n    console.log(event.type, event.path.join('.'), event.property);\n  } else {\n    console.log(event.type, event.path.join('.'));\n  }\n});\n\nvar Test = emitter.Test;\nvar bob = new Test;\n\nconsole.log(bob);\n//-->\n  construct Test\n  get Test.[[0]] inspect  // instances created via construct are indexed and displayed as [[#]]\n  keys Test.[[0]]\n  describe Test.[[0]] name\n  { name: 'bob' }\n\nbob.stuff = { x: ['a',',b','c'] }\nconsole.log(bob.stuff.x[0]);\n\n//-->\n  set Test.[[0]] stuff\n  get Test.[[0]] stuff\n  get Test.[[0]].stuff x\n  get Test.[[0]].stuff.x 0\n  a\n```\n\n\n## proxy\nA easier to use proxy that's closer to the new Proxy spec than the old one, but with some niceities to make proxy handler creation much simpler. When creating a proxy you provide the object to mirror and the handler. The default action is to forward all actions to the provided target, no traps need be implemented at all.\n```javascript\nvar proxied = meta.proxy(target, handler);\n```\n__Traps__\nSome traps have been renamed because I hate long names. Parameters have been reordered for convenience. The first parameter for all traps is `fwd`, a function that will forward the event to the target. It takes no arguments but has three properties which can be modified. `fwd` can be invoked multiple times, allowing you to, for example, mirror the action against two separate targets.\n\n* __fwd.target__ can be changed to forward the event to something else.\n* __fwd.args__ is an array with the arguments starting after target. For example, to change the property for traps against a specific property, you would do `fwd.args[0] = 'differentProperty'; fwd();`\n* __fwd.trap__ The string name of the trap. Changing this invokes a different forwarding action. For example, in the `keys` trap you could change it to `names` which would then show hidden properties instead of non-hidden ones.\n\n\n```javascript\nkeys      [fwd, target]\nnames     [fwd, target]\nenumerate [fwd, target]\nfix       [fwd, target]\nowns      [fwd, target, prop]\nhas       [fwd, target, prop]\ndelete    [fwd, target, prop]\ndescribe  [fwd, target, prop]\ndefine    [fwd, target, prop, descriptor]\nget       [fwd, target, prop, receiver]\nset       [fwd, target, prop, value, receiver]\napply     [fwd, target, args, receiver]\nconstruct [fwd, target, args]\n```\n\n## membrane\nTakes a proxy handler designed for the above proxy handler api and makes it into a membrane that automatically wraps all outbound objects and unwraps all inbound objects. The handlers only see unwrapped normal objects so it's no more complicated than creating a normal proxy.\n\n## Emitter\nAn object that's cross between DOM events and Node's EventEmitter. Event objects are either used or created which include information about the current target and type of event. Handlers and meta information aren't stored on the emitter itself which allows for separation of the event process and an objects normal operation. An emitter can \"forward\" all event subscriptions from itself to another object such that doing `obj.on('event', callback)` subscribes to events emitted by `obj2`.\n\nThe `this` binding for all callbacks is the emitter of the event, and the first parameter is and `event` object which includes the target of the event. This is usually the same as the emitter, but in some cases it may be different. If events are forwarded to another object, or if you're listening to a prototype and getting __all__ events for every instance inheriting from it, the `this` binding will be the object you registered with using `emitter.on`, and the target will be the object responsible for emitting the event. This is similar to how most DOM frameworks work with event delegation and dispatching.\n\n## WrapMap\nA utility class for simplifying usage of creating wrapper/unwrappers that use WeakMaps. Simply provide a callback function that accepts an input unwrapped object and returns a wrapped version. The result is a `WrapMap` instance with the following functions\n\n* wrap - Wraps objects if they aren't already wrapped. Returns primitives and wrapped objects unmodified.\n* unwrap - Unwraps wrapped objects and returns primitives and unwrapped objects unmodified.\n* wrapDescriptor - Applies the wrapper to `obj.value`, `obj.set`, and `obj.set` but not the base object itself. Modifies the descriptor.\n* unwrapDescriptor - Unwraps `value`, `set`, and `get`. Modifies the descriptor.\n* remove - Unwrap object and remove from the map, returning the unwrapped object.\n* has - Boolean testing if a given object is wrapped.\n\n```javascript\nvar arrayer = new WrapMap(function(obj){\n  return [];\n});\n\nvar test = arrayer.wrap(function test(){});\nconsole.log(test);\n//-->\n  []\n\nconsole.log(arrayer.unwrap(test));\n//-->\n  [Function: test];\n```","maintainers":[{"name":"benvie","email":"brandon@bbenvie.com"}]},"0.2.7":{"author":{"name":"Brandon Benvie","email":"brandon@bbenvie.com","url":"http://bbenvie.com"},"name":"meta-objects","description":"Utilities and patterns for using Harmony Proxies to meta-program. Proxies as Proxy handlers, catch all forwarders for catch all forwarders, intercession introspection. Now you're thinking with portals.","keywords":["harmony","proxy","meta","objects","membrane","ecmascript","functional","partial","weakmap","trace"],"version":"0.2.7","repository":{"url":"https://github.com/Benvie/meta-objects"},"main":"./index.js","engines":{"node":">=0.6.6"},"dependencies":{},"devDependencies":{},"_npmUser":{"name":"benvie","email":"brandon@bbenvie.com"},"_id":"meta-objects@0.2.7","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.18","_nodeVersion":"v0.7.8","_defaultsLoaded":true,"dist":{"shasum":"e7fa39d925ffa6cafd0ce38b1ca4feede31e0c6a","tarball":"https://registry.npmjs.org/meta-objects/-/meta-objects-0.2.7.tgz","integrity":"sha512-+Wc8ODLl7My8kRdglg3sGctpeYAFOr26yJqMxH3rJkEjOZ99kESxQ8iFbURpO9LuAYEp0/BkkkxDgZpmnqNMqg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICP+viLx2FIq9EtInofgnp5UkQ/1EYsG31ZKzYRJunflAiEAvhlsFKCnkdW4mGbTMLK7qN2eRtaUlVTfBXnvfNwhoWQ="}]},"readme":"# Meta-Objects\n\nTools for making meta-objects. These are broken down into two categories. One category is lower level tools that would be used for library authors, people making virtual objects, etc. The other is tools built on top of those, that are ready to use out of the box for easy usage.\n\n### Easy to use interfaces\n\n* __callable__ - Takes an object and returns a callable and constructable version of it, which use the __$$call__ and __$$construct__ properties on the object.\n* __multiherit__ - Creates a meta class from multiple constructors that combines all of them into one. Prototypal inheritance with multiple prototypes and multiple constructors.\n* __tracer__ - Creates a clone object from the provided object that emits __all__ things that happen to it. It's like databinding on crack.\n* __interceptor__ - Turns normal getters/setters on prototypes, get/set/length into indexed properties like buffers, and get/set/has/list into named properties like DOM css objects.\n\n* __proxy__ - Simplifies creation of ES6 proxies by handling everything you don't want to and providing ways to forward and subtly modify a target object.\n* __membrane__ - Accepts the same parameters that would be provided to __proxy__ but returns an object that will automatically wrap and unwrap all sub-objects gotten from property access, function calling, constructors, etc.\n* __deppelgangar__ - An object with mutatable persona. That is, it has a single JavaScript identity (used in `===` for example) but allows you to arbitrarily reassign what object it mirrors, at any time.\n\n\n* __WrapMap__ - Mostly internal use tool for wrapping/unwrapping objects, used by membranes.\n* __Emitter__ - A cross-between Node's emitters and the DOM event system. Used by tracer.\n\n\n# Install\n\n__This library relies on features from the next version of ECMAScript and isn't going to work in most environments.__\n\n`WeakMap` and `Proxy` are required. This library works in:\n\n* Firefox 4+\n* Chrome 18+ with the `experimental javascript` flag enabled\n* Node 0.7+ when run like so `node --harmony`\n\n__Browser__\n```html\n<script src=\"meta-objects.browser.min.js\"></script>\n<scrript>console.log(meta)</scrript>\n```\n\n__Node.js__\n```\nnpm install meta-objects\n```\n```javascript\nvar meta = require('meta-objects');\nconsole.log(meta);\n```\n\n## Interceptors\nThe interceptor function turns an existing Constructor and its prototype into a more versatile interface, depending on what methods you provide on the prototype. For any properties that aren't intercepted by the below methods the properties will simply work like normal.\n\nAll of the below are created by just calling `meta.interceptor(Constructor)`. The interface bestowed on your prototype will base based on the methods available on it.\n\n* Interceptor - is the baseline. It simply uses any getter/setters on your prototype and shows instances as having them as own regular properties.\n* IndexedInterceptor - If your prootype has `length`, `get`, and (optionally) `set` functions then the interface will additionally show indexed properties as own normal properties, utilizing those functions to fulfill interaction with numbered properties. This allows you to implement objects with buffer type interfaces that previously would be done in C++.\n* NamedInterceptor - If you provide a `list` and `has` function instead of `length` (along with `get`/optional `set`) your class will be be upgraded to an interface that provides those properties as named own normal properties.\n\nYou will receive a new constructor with a new prototype that will denend on the originally provided ones in order to work, but any objects created will be instances of the new prototype and the new prototype will show have the new constructor as its constructor.\n\n\n## Doppelganger\n\nThe doppelganger is a simple interface. Calling `meta.doppelganger(callable?)` will return a function that changes the identity of your new doppelgagner instance, and also returns it. Whether an object is callable as a function is not mutable after creation, so you have to decide up front. A callable one will be `typeof === 'function'`.\n\n```javascript\nvar changeInto = meta.doppelganger();\n\n// the first call actually provides the object to you\nvar doppel = changeInto(document);\nconsole.log(doppel.location);\n\nchangeInto([1,2, 3]);\nconsole.log(doppel.length);\n\n## Callable Objects\nA simple to use function that takes an object and returns a mirror of it that is callable and constructable. All changes to one reflect the other so they are in effect the same object, except the returned version is a function and they are not `===`.\n\n__callable(obj)__\n\n* __obj.$$call__ - If present, this function will be called when the callable object is in any manner. `obj()` or `obj.call(x, args...)`. `this` is bound to the object itself so using call, bind, or apply won't have any effect on `this`.\n* __obj.$$construct__ - If preset, this function will be called whenever the object is constructed using `new obj(...args)`. `this` will be a newly created object as if created using `Object.create(obj)` but it will also be callable and not just an object.\n\nIf `obj.$$call` is not present then the call will simply do nothing. If `obj.$$construct` is not present, then the newly created callable child of the object will be returned as is, so it's still useful for creating new instances without any constructor logic.\n\n`obj.$$call` and `obj.$$construct` are completely invisible properties but (currently) are still gettable and settable. It's likely this will be changed so there's some specific procedure for assessing these essentially private properties.\n\n\n```javascript\nvar obj = {\n  y: 10,\n  $$call: function(){\n    return this.y++;\n  }\n};\nvar cobj = callable(obj);\n\nconsole.log(obj);\n//-->\n  { y: 10, $$call: [Function] }\n\nconsole.log(cobj);\n//-->\n  { [Function] y: 10 }\n\ncobj();\nconsole.log(cobj);\n//-->\n  { [Function] y: 11 }\n```\n\n## Multiple Inheritance\nThe __multiherit__ function provided allows for simple creation of classes that inherit from multiple objects. That is, you provide a set of constructors (and implicitly the `.prototype` for each) and in return you receive a single constructor with a single prototype. The constructor invokes all of the provided constructors in the order provided. The prototype combines all of the properties of the prototypes, in preference to the order provided.\n\n__multiherit(options)__\n\n* __options.ctors__ is an array of constructors that will be composed. The `prototype` property will be used for determining the list of prototypes.\n* __options.params__(strings) is an array of names that will be used to map params given to the combined ctor to each of the individual ctors. The names are matched to the named parameters of each ctor.\n* __options.params__(number arrays) can be used instead to map the parameters by input order to the matching index ctor.\n* __options.name__ optionally sets a specific name for the resulting Ctor. If not provided it will be made from combining the names of the given ctors.\n* __options.onCall__ optionally make instances callable and provide the function to call when they are called\n* __options.onConstruct__ optionally make instances constructable and provide the constructor function\n\n```javascript\nfunction Talks(name, says){\n  this.name = name;\n  this.says = says;\n}\n\nTalks.prototype = {\n  speak: function speak(at){\n    at(this.name + ' says: ' + this.says);\n  }\n};\n\nfunction Walks(name, stride){\n  this.name = name;\n  this.stride = stride;\n}\n\nWalks.prototype = {\n  move: function move(where){\n    var self = this;\n    setTimeout(function(){\n      where[self.name] = self;\n      self.location = where;\n    }, this.stride);\n  }\n}\n\nfunction Fondles(desires){\n  this.desires = desires;\n}\n\nFondles.prototype = {\n  touch: function touch(who){\n    this.felt = who[this.desires];\n  }\n};\n\n// parameter names are used to map the combined ctor's parameters to the set of constructors\nvar WalksTalksFondles = multiherit({\n  ctors: [Walks, Talks, Fondles],\n  params: ['name', 'says', 'stride', 'desires']\n});\nconsole.log(WalksTalksFondles)\n//-->\n  [Function: WalksTalksFondles]\n\n// the combined prototype can also have its own properties separate from any it inherits\nWalksTalksFondles.prototype.type = 'man';\n\n// the inheritance is dynamic, just like normal [[prototypes]]\nWalks.prototype.speed = 1000;\n\nconsole.log(WalksTalksFondles.prototype)\n//-->\n  { type: 'man',\n    move: [Function: move],\n    speed: 1000,\n    speak: [Function: speak],\n    touch: [Function: touch] }\n\n\nvar bob = new WalksTalksFondles('bob', 'hey guys', 100, 'name');\nbob.touch(Object)\nbob.speak(console.log); //bob says: hey guys\nconsole.log(bob);\n//-->\n  { name: 'bob',\n    stride: 100,\n    says: 'hey guys',\n    desires: 'name',\n    felt: 'Object' }\n\nconsole.log(bob.constructor)\n//-->\n  [Function: WalksTalksFondles]\n\n```\n\n\n## Tracer Objects\nThe `tracer` function takes any object and produces an event emitter along with a clone of the object. All interactions with the cloned version will be broadcast from the emitter. The clone can be interacted with in any way as if it were the real object. Any sub-object gotten from the clone through property access, function calling, constructors, etc. will also be a clone that broadcasts to the emitter.\n\n```javascript\nvar emitter = meta.tracer(function Test(){ this.name = 'bob' }, 'Test');\nemitter.on('*', function(event){\n  if (event.property) {\n    console.log(event.type, event.path.join('.'), event.property);\n  } else {\n    console.log(event.type, event.path.join('.'));\n  }\n});\n\nvar Test = emitter.Test;\nvar bob = new Test;\n\nconsole.log(bob);\n//-->\n  construct Test\n  get Test.[[0]] inspect  // instances created via construct are indexed and displayed as [[#]]\n  keys Test.[[0]]\n  describe Test.[[0]] name\n  { name: 'bob' }\n\nbob.stuff = { x: ['a',',b','c'] }\nconsole.log(bob.stuff.x[0]);\n\n//-->\n  set Test.[[0]] stuff\n  get Test.[[0]] stuff\n  get Test.[[0]].stuff x\n  get Test.[[0]].stuff.x 0\n  a\n```\n\n\n## proxy\nA easier to use proxy that's closer to the new Proxy spec than the old one, but with some niceities to make proxy handler creation much simpler. When creating a proxy you provide the object to mirror and the handler. The default action is to forward all actions to the provided target, no traps need be implemented at all.\n```javascript\nvar proxied = meta.proxy(target, handler);\n```\n__Traps__\nSome traps have been renamed because I hate long names. Parameters have been reordered for convenience. The first parameter for all traps is `fwd`, a function that will forward the event to the target. It takes no arguments but has three properties which can be modified. `fwd` can be invoked multiple times, allowing you to, for example, mirror the action against two separate targets.\n\n* __fwd.target__ can be changed to forward the event to something else.\n* __fwd.args__ is an array with the arguments starting after target. For example, to change the property for traps against a specific property, you would do `fwd.args[0] = 'differentProperty'; fwd();`\n* __fwd.trap__ The string name of the trap. Changing this invokes a different forwarding action. For example, in the `keys` trap you could change it to `names` which would then show hidden properties instead of non-hidden ones.\n\n\n```javascript\nkeys      [fwd, target]\nnames     [fwd, target]\nenumerate [fwd, target]\nfix       [fwd, target]\nowns      [fwd, target, prop]\nhas       [fwd, target, prop]\ndelete    [fwd, target, prop]\ndescribe  [fwd, target, prop]\ndefine    [fwd, target, prop, descriptor]\nget       [fwd, target, prop, receiver]\nset       [fwd, target, prop, value, receiver]\napply     [fwd, target, args, receiver]\nconstruct [fwd, target, args]\n```\n\n## membrane\nTakes a proxy handler designed for the above proxy handler api and makes it into a membrane that automatically wraps all outbound objects and unwraps all inbound objects. The handlers only see unwrapped normal objects so it's no more complicated than creating a normal proxy.\n\n## Emitter\nAn object that's cross between DOM events and Node's EventEmitter. Event objects are either used or created which include information about the current target and type of event. Handlers and meta information aren't stored on the emitter itself which allows for separation of the event process and an objects normal operation. An emitter can \"forward\" all event subscriptions from itself to another object such that doing `obj.on('event', callback)` subscribes to events emitted by `obj2`.\n\nThe `this` binding for all callbacks is the emitter of the event, and the first parameter is and `event` object which includes the target of the event. This is usually the same as the emitter, but in some cases it may be different. If events are forwarded to another object, or if you're listening to a prototype and getting __all__ events for every instance inheriting from it, the `this` binding will be the object you registered with using `emitter.on`, and the target will be the object responsible for emitting the event. This is similar to how most DOM frameworks work with event delegation and dispatching.\n\n## WrapMap\nA utility class for simplifying usage of creating wrapper/unwrappers that use WeakMaps. Simply provide a callback function that accepts an input unwrapped object and returns a wrapped version. The result is a `WrapMap` instance with the following functions\n\n* wrap - Wraps objects if they aren't already wrapped. Returns primitives and wrapped objects unmodified.\n* unwrap - Unwraps wrapped objects and returns primitives and unwrapped objects unmodified.\n* wrapDescriptor - Applies the wrapper to `obj.value`, `obj.set`, and `obj.set` but not the base object itself. Modifies the descriptor.\n* unwrapDescriptor - Unwraps `value`, `set`, and `get`. Modifies the descriptor.\n* remove - Unwrap object and remove from the map, returning the unwrapped object.\n* has - Boolean testing if a given object is wrapped.\n\n```javascript\nvar arrayer = new WrapMap(function(obj){\n  return [];\n});\n\nvar test = arrayer.wrap(function test(){});\nconsole.log(test);\n//-->\n  []\n\nconsole.log(arrayer.unwrap(test));\n//-->\n  [Function: test];\n```","maintainers":[{"name":"benvie","email":"brandon@bbenvie.com"}]}},"maintainers":[{"name":"benvie","email":"brandon@bbenvie.com"}],"time":{"modified":"2022-06-19T18:07:20.178Z","created":"2011-11-15T22:58:25.141Z","0.0.1":"2011-11-15T22:58:26.418Z","0.0.7":"2011-12-21T11:57:41.738Z","0.0.8":"2011-12-21T12:19:19.785Z","0.0.9":"2011-12-24T22:58:31.768Z","0.1.0":"2011-12-25T22:12:35.832Z","0.1.2":"2011-12-26T08:00:46.073Z","0.1.3":"2011-12-26T08:08:47.008Z","0.1.4":"2012-04-13T23:17:43.279Z","0.1.5":"2012-04-14T02:02:08.229Z","0.1.6":"2012-04-14T02:03:55.251Z","0.1.7":"2012-04-15T01:37:05.279Z","0.1.8":"2012-04-15T13:28:44.779Z","0.1.9":"2012-04-22T21:25:18.240Z","0.2.0":"2012-04-22T23:24:02.932Z","0.2.1":"2012-04-22T23:40:14.218Z","0.2.3":"2012-05-14T19:21:32.891Z","0.2.5":"2012-05-17T06:29:57.554Z","0.2.6":"2012-05-17T21:01:26.496Z","0.2.7":"2012-05-18T15:19:35.637Z"},"author":{"name":"Brandon Benvie","email":"brandon@bbenvie.com","url":"http://bbenvie.com"},"repository":{"url":"https://github.com/Benvie/meta-objects"}}