{"_id":"defo","_rev":"37-8e87835245b5aac6329ced5f37f38f0d","name":"defo","description":"A method_missing(or Hash.new) lib for JavaScript","dist-tags":{"latest":"2.1.3"},"versions":{"0.0.1":{"name":"defo","version":"0.0.1","description":"A wrapped JS Object which can set default value ","main":"defo.js","directories":{"test":"test"},"scripts":{"test":"mocha"},"keywords":["object","default","value"],"author":{"name":"Alsotang","email":"alsotang@gmail.com"},"license":"MIT","devDependencies":{"mocha":"~1.12.1","chai":"~1.7.2"},"readme":"ERROR: No README data found!","_id":"defo@0.0.1","dist":{"shasum":"1546915f20721b2736d831913f98e00fbb3dca16","tarball":"https://registry.npmjs.org/defo/-/defo-0.0.1.tgz","integrity":"sha512-FC7uXVkD7o4Fhn5Pd24p7rbySE8ZhriKAhklM3kW+Lm51oFXfwxmQVU9LJEH/LVIO98whTTvYbQl+pGYr8XibA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAXb5sf4VfD/rAasysyy47qRczze/lMe33u2OJygpKSfAiAYAmHz1vlYZePpxZt3MdIK8oSdFUAwMuG8LDaMJa30+Q=="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"alsotang","email":"alsotang@gmail.com"},"maintainers":[{"name":"alsotang","email":"alsotang@gmail.com"}]},"0.1.0":{"name":"defo","version":"0.1.0","description":"A method_missing lib of JavaScript","main":"defo.js","directories":{"test":"test"},"scripts":{"test":"mocha"},"repository":{"type":"git","url":"https://github.com/alsotang/defo"},"keywords":["object","default-value"],"author":{"name":"Alsotang","email":"alsotang@gmail.com"},"license":"MIT","devDependencies":{"mocha":"~1.12.1","chai":"~1.7.2"},"readme":"# Defo\n----\n\nA method_missing lib of JavaScript.\n\n## Installation\n----\n\n`npm install defo`\n\n\n## Usage\n----\n\nSet default value with a literal JS Object\n```javascript\nvar Defo = require('defo');\nvar defo = new Defo({a: 1, b: 2});\nconsole.log(defo.get('foo')); // => {a: 1, b: 2}\nconsole.log(defo.get('bar')); // => {a: 1, b: 2}\n```\n\nMore advanced, with a Function\n\n```javascript\nvar Defo = require('defo');\n\nvar defo = new Defo(function (key) {\n  return key + '!!!';\n});\n\nconsole.log(defo.get('Hello')); // => Hello!!!\n```\n\n## License\n----\n\nMIT http://rem.mit-license.org","readmeFilename":"README.md","bugs":{"url":"https://github.com/alsotang/defo/issues"},"_id":"defo@0.1.0","dist":{"shasum":"f3f315fb7a55b2f86f01e1158631d2a96320a8b5","tarball":"https://registry.npmjs.org/defo/-/defo-0.1.0.tgz","integrity":"sha512-26b587326CadkASqtb9BJstMtYB9IRv3vqn8EoSD0myTHnygMvF80bDKMduinReZvOoWB3smgCKaPEBAXug9og==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGJt5DkeNRyzuLTwG4WQ+FjW1N0A9wR2hCN4r+AXBMueAiEA+Vpxts4dZIKLkISqzLj95PAqnToyHEIvI6KftOkFa6I="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"alsotang","email":"alsotang@gmail.com"},"maintainers":[{"name":"alsotang","email":"alsotang@gmail.com"}]},"0.1.1":{"name":"defo","version":"0.1.1","description":"A method_missing lib of JavaScript","main":"defo.js","directories":{"test":"test"},"scripts":{"test":"mocha"},"repository":{"type":"git","url":"https://github.com/alsotang/defo"},"keywords":["method_missing","default-value"],"author":{"name":"Alsotang","email":"alsotang@gmail.com"},"license":"MIT","devDependencies":{"mocha":"~1.12.1","chai":"~1.7.2"},"readme":"# Defo\n\nA method_missing lib of JavaScript.\n\n## Installation\n\n`npm install defo`\n\n## Usage\n\nSet default value with a literal JS Object\n```javascript\nvar Defo = require('defo');\nvar defo = new Defo({a: 1, b: 2});\nconsole.log(defo.get('foo')); // => {a: 1, b: 2}\nconsole.log(defo.get('bar')); // => {a: 1, b: 2}\n```\n\nMore advanced, with a Function\n\n```javascript\nvar Defo = require('defo');\n\nvar defo = new Defo(function (key) {\n  return key + '!!!';\n});\n\nconsole.log(defo.get('Hello')); // => Hello!!!\n```\n\n## License\n\nMIT http://rem.mit-license.org","readmeFilename":"README.md","bugs":{"url":"https://github.com/alsotang/defo/issues"},"_id":"defo@0.1.1","dist":{"shasum":"dd254c54a857183df166feed331f6a9903e45227","tarball":"https://registry.npmjs.org/defo/-/defo-0.1.1.tgz","integrity":"sha512-83KKZAIXcZrIwoNYZBeRYlxODfc6tpnwL2smF4vWcS9ugLA7rEg7Gsx22EE18pxONh1+UtV1gZx65bFJYoMIcg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD2biQKe2jT1a9hpmCU1XmbiHhaOB+/BTQVpZjb7UQ99QIhAJk7lB1ZrzQRd//QTan71Q01RlfUwJtHtcqr999fjQ+4"}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"alsotang","email":"alsotang@gmail.com"},"maintainers":[{"name":"alsotang","email":"alsotang@gmail.com"}]},"0.1.2":{"name":"defo","version":"0.1.2","description":"A method_missing lib of JavaScript","main":"defo.js","directories":{"test":"test"},"scripts":{"test":"mocha"},"repository":{"type":"git","url":"https://github.com/alsotang/defo"},"keywords":["method_missing","default-value"],"author":{"name":"Alsotang","email":"alsotang@gmail.com"},"license":"MIT","devDependencies":{"mocha":"~1.12.1","chai":"~1.7.2"},"engines":{"node":"*"},"readme":"# Defo\n\n[![Build Status](https://travis-ci.org/alsotang/defo.png?branch=master)](https://travis-ci.org/alsotang/defo)\n\nA method_missing lib of JavaScript.\n\n## Installation\n\n`npm install defo`\n\n## Usage\n\nSet default value with a literal JS Object\n```javascript\nvar Defo = require('defo');\nvar defo = new Defo({a: 1, b: 2});\nconsole.log(defo.get('foo')); // => {a: 1, b: 2}\nconsole.log(defo.get('bar')); // => {a: 1, b: 2}\n```\n\nMore advanced, with a Function\n\n```javascript\nvar Defo = require('defo');\n\nvar defo = new Defo(function (key) {\n  return key + '!!!';\n});\n\nconsole.log(defo.get('Hello')); // => Hello!!!\n```\n\nTo see more(and more advanced) examples, please visit:\n\n[Examples](https://github.com/alsotang/defo/blob/master/test/defo.test.js)\n\n## License\n\nMIT http://rem.mit-license.org","readmeFilename":"README.md","bugs":{"url":"https://github.com/alsotang/defo/issues"},"_id":"defo@0.1.2","dist":{"shasum":"2ce01f0602437ae4f8e50ff7d4f6ddf2c1bc6585","tarball":"https://registry.npmjs.org/defo/-/defo-0.1.2.tgz","integrity":"sha512-AQMWKTX8uptHMoaki1E3pZZvWgy/8rdh8vneKnYP5U6xm7a3w+cEe4/HoEnLRRhpgth1S285oBUi82tkIhE+rw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDEA/he0dWJfha79QsE5M7cr36zen0+lFa5cvdsHQ9ZvwIhAJvYVqrvaU5mXUnrl6Q5KmydwdZ/lZ0J+NQTc5BLt0DH"}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"alsotang","email":"alsotang@gmail.com"},"maintainers":[{"name":"alsotang","email":"alsotang@gmail.com"}]},"0.1.3":{"name":"defo","version":"0.1.3","description":"A method_missing lib of JavaScript","main":"defo.js","directories":{"test":"test"},"scripts":{},"repository":{"type":"git","url":"https://github.com/alsotang/defo"},"keywords":["method_missing","default-value"],"author":{"name":"Alsotang","email":"alsotang@gmail.com"},"license":"MIT","devDependencies":{"mocha":"~1.12.1","chai":"~1.7.2","blanket":"~1.1.5"},"engines":{"node":"*"},"readme":"# Defo\n\n[![Build Status](https://travis-ci.org/alsotang/defo.png?branch=master)](https://travis-ci.org/alsotang/defo)\n\nA method_missing lib of JavaScript.\n\n## Installation\n\n`npm install defo`\n\n## Usage\n\nSet default value with a literal JS Object\n```javascript\nvar Defo = require('defo');\nvar defo = new Defo({a: 1, b: 2});\nconsole.log(defo.get('foo')); // => {a: 1, b: 2}\nconsole.log(defo.get('bar')); // => {a: 1, b: 2}\n```\n\nMore advanced, with a Function\n\n```javascript\nvar Defo = require('defo');\n\nvar defo = new Defo(function (key) {\n  return key + '!!!';\n});\n\nconsole.log(defo.get('Hello')); // => Hello!!!\n```\n\nTo see more(and more advanced) examples, please visit:\n\n[More Examples](https://github.com/alsotang/defo/blob/master/test/defo.test.js)\n\n## License\n\nMIT http://rem.mit-license.org","readmeFilename":"README.md","bugs":{"url":"https://github.com/alsotang/defo/issues"},"_id":"defo@0.1.3","dist":{"shasum":"3aea72d611cd780f191f62fd4727a5b2321e9d49","tarball":"https://registry.npmjs.org/defo/-/defo-0.1.3.tgz","integrity":"sha512-ai7IO1Fj3APqomHylyESh9/bbsarbz4weaOBRZA40Jh7+mJAWIF1gv/TjUWDQKpKXkqS2ja46bUbJPycliUoxQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHzDoVubwKVKu+n564iHiQ11rYjqm6E1KzfmOeOOy0wXAiEAn/aPXpPwTUVW27++9w7+ZU/63tiX5DIPBAob3Ldm3oM="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"alsotang","email":"alsotang@gmail.com"},"maintainers":[{"name":"alsotang","email":"alsotang@gmail.com"}]},"0.2.3":{"name":"defo","version":"0.2.3","description":"A method_missing lib of JavaScript","main":"defo.js","directories":{"test":"test"},"scripts":{},"repository":{"type":"git","url":"https://github.com/alsotang/defo"},"keywords":["method_missing","default-value"],"author":{"name":"Alsotang","email":"alsotang@gmail.com"},"license":"MIT","devDependencies":{"mocha":"~1.12.1","chai":"~1.7.2","blanket":"~1.1.5"},"engines":{"node":"*"},"readme":"# Defo\n\n[![Build Status](https://travis-ci.org/alsotang/defo.png?branch=master)](https://travis-ci.org/alsotang/defo)\n\nA method_missing lib of JavaScript.\n\n## Installation\n\n`npm install defo`\n\n## Quick Examples\n\nSet default value with a literal JS Object\n```javascript\nvar Defo = require('defo');\nvar defo = new Defo({a: 1, b: 2});\nconsole.log(defo.get('foo')); // => {a: 1, b: 2}\nconsole.log(defo.get('bar')); // => {a: 1, b: 2}\n```\n\nMore advanced, with a Function\n\n```javascript\nvar Defo = require('defo');\n\nvar defo = new Defo(function (key) {\n  return key + '!!!';\n});\n\nconsole.log(defo.get('Hello')); // => Hello!!!\n```\n\nTo see more(and more advanced) examples, please visit:\n\n[More Examples](https://github.com/alsotang/defo/blob/master/test/defo.test.js)\n\n## Documentation\n\n* initialize\n* set\n* get\n* to_object\n\n### initialize\n\nDefo can be initialize when create a new Defo instance\n\nWith literal object:\n\n```javascript\nvar defo = new Defo({{a: 1, b: 2}});\nvar defo2 = new Defo([1, 2, 3]);\n```\n\nWith a function:\n\n```js\nvar defo = new Defo(function (key) {\n  // dosomething with key\n  return key;\n});\n```\n\n### set && get\n\n```js\nvar defo = new Defo();\ndefo.set('person', {name: 'Alsotang', age: 21});\ndefo.get('person').height = 1.80;\nconsole.log(defo.get('person')); // => { name: 'Alsotang', age: 21, height: 1.8 }\n```\n\nchaining set\n\n```js\nvar defo = new Defo();\n\ndefo\n  .set('person', {name: 'Alsotang', age: 21})\n  .set('pet', {name: 'Piglet', age: 3});\ndefo.get('person').height = 1.80;\nconsole.log(defo.to_object()); // => { person: { name: 'Alsotang', age: 21, height: 1.8 },\n                                       pet: { name: 'Piglet', age: 3 } }\n```\n\n### to_object\n\nto_object would convert your Defo to a JavaScript Object.\n\nThis method will create a new object instead of modify Defo object.\n\n```js\nvar person = new Defo();\nperson\n  .set('name', 'Alsotang')\n  .set('age', 21);\n\nvar pet = new Defo();\npet\n  .set('name', 'Piglet')\n  .set('age', 3);\n\nvar house = new Defo();\nhouse\n  .set('person', person)\n  .set('pet', pet);\n\nconsole.log(house.to_object());\n// output:\n// { person: { name: 'Alsotang', age: 21 },\n//   pet: { name: 'Piglet', age: 3 } }\n```\n\n## License\n\nMIT http://rem.mit-license.org","readmeFilename":"README.md","bugs":{"url":"https://github.com/alsotang/defo/issues"},"_id":"defo@0.2.3","dist":{"shasum":"821bfbf88433b57c886be5c93ec841109e3a303c","tarball":"https://registry.npmjs.org/defo/-/defo-0.2.3.tgz","integrity":"sha512-LO9PDUeBeaSI322xg2/OUEfoMnm7fGi5GNvmLII2ul6FlIGpmrU1zNab7coR2miXhd21iZqOQC6X550AGJISqg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH95PMBR2zOgEtstUbT5fttvOv8DC6iWbZk4ofGg3hL0AiAfszEtye+0kCjQlikFmTSKGgY1LuxTIOkqom0woWh2WA=="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"alsotang","email":"alsotang@gmail.com"},"maintainers":[{"name":"alsotang","email":"alsotang@gmail.com"}]},"0.2.4":{"name":"defo","version":"0.2.4","description":"A method_missing lib for JavaScript","main":"defo.js","directories":{"test":"test"},"scripts":{},"repository":{"type":"git","url":"https://github.com/alsotang/defo"},"keywords":["method_missing","default-value"],"author":{"name":"Alsotang","email":"alsotang@gmail.com"},"license":"MIT","devDependencies":{"mocha":"~1.12.1","chai":"~1.7.2","blanket":"~1.1.5"},"engines":{"node":"*"},"readme":"# Defo\n\n[![Build Status](https://travis-ci.org/alsotang/defo.png?branch=master)](https://travis-ci.org/alsotang/defo)\n\nA method_missing lib for JavaScript.\n\n## Installation\n\n`npm install defo`\n\n## Quick Examples\n\nSet default value with a literal JS Object\n```javascript\nvar Defo = require('defo');\nvar defo = new Defo({a: 1, b: 2});\nconsole.log(defo.get('foo')); // => {a: 1, b: 2}\nconsole.log(defo.get('bar')); // => {a: 1, b: 2}\n```\n\nMore advanced, with a Function\n\n```javascript\nvar Defo = require('defo');\n\nvar defo = new Defo(function (key) {\n  return key + '!!!';\n});\n\nconsole.log(defo.get('Hello')); // => Hello!!!\n```\n\nTo see more(and more advanced) examples, please visit:\n\n[More Examples](https://github.com/alsotang/defo/blob/master/test/defo.test.js)\n\n## Documentation\n\n* #initialize\n* #set\n* #get\n* #to_object\n\n### #initialize\n\nDefo can be initialize when create a new Defo instance\n\nWith literal object:\n\n```javascript\nvar defo = new Defo({{a: 1, b: 2}});\nvar defo2 = new Defo([1, 2, 3]);\n```\n\nWith a function:\n\n```js\nvar defo = new Defo(function (key) {\n  // dosomething with key\n  return key;\n});\n```\n\n### #set && get\n\n```js\nvar defo = new Defo();\ndefo.set('person', {name: 'Alsotang', age: 21});\ndefo.get('person').height = 1.80;\nconsole.log(defo.get('person')); // => { name: 'Alsotang', age: 21, height: 1.8 }\n```\n\nchaining set\n\n```js\nvar defo = new Defo();\n\ndefo\n  .set('person', {name: 'Alsotang', age: 21})\n  .set('pet', {name: 'Piglet', age: 3});\ndefo.get('person').height = 1.80;\nconsole.log(defo.to_object());\n// output:\n// { person: { name: 'Alsotang', age: 21, height: 1.8 },\n//   pet: { name: 'Piglet', age: 3 } }\n```\n\nHash set\n```js\nvar defo = new Defo();\ndefo.set({\n  name: 'Alsotang',\n  age: 21\n});\ndefo.get('name').should.equal('Alsotang'); // => true\ndefo.get('age').should.equal(21); // => true\n```\n\n### #to_object\n\nto_object would convert your Defo to a JavaScript Object.\n\nThis method will create a new object instead of modify Defo object.\n\n```js\nvar person = new Defo();\nperson\n  .set('name', 'Alsotang')\n  .set('age', 21);\n\nvar pet = new Defo();\npet\n  .set('name', 'Piglet')\n  .set('age', 3);\n\nvar house = new Defo();\nhouse\n  .set('person', person)\n  .set('pet', pet);\n\nconsole.log(house.to_object());\n// output:\n// { person: { name: 'Alsotang', age: 21 },\n//   pet: { name: 'Piglet', age: 3 } }\n```\n\n## License\n\nMIT http://rem.mit-license.org","readmeFilename":"README.md","bugs":{"url":"https://github.com/alsotang/defo/issues"},"_id":"defo@0.2.4","dist":{"shasum":"711fc57a851491694b270451c2dc662e245c0324","tarball":"https://registry.npmjs.org/defo/-/defo-0.2.4.tgz","integrity":"sha512-MbwJkg5tVjIUzvF3RsJwyipX3M3eNTyraPg4tltjaYKBgyuqsQJq56DToX26gGjKzVha+Ot0pFV8NIi4FRwKJw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA4qSD3ilc4wnBcMuZPcTfMqk+hxtyIEQeEWDC7VlihhAiBxDVtFBcEZ1HUy9XjIN1MIIALRsVdwatBqGITWSmKCeg=="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"alsotang","email":"alsotang@gmail.com"},"maintainers":[{"name":"alsotang","email":"alsotang@gmail.com"}]},"0.2.5":{"name":"defo","version":"0.2.5","description":"A method_missing lib for JavaScript","main":"defo.js","directories":{"test":"test"},"scripts":{},"repository":{"type":"git","url":"https://github.com/alsotang/defo"},"keywords":["method_missing","default-value"],"author":{"name":"Alsotang","email":"alsotang@gmail.com"},"license":"MIT","devDependencies":{"mocha":"~1.12.1","chai":"~1.7.2","blanket":"~1.1.5"},"engines":{"node":"*"},"readme":"# Defo\n\n[![Build Status](https://travis-ci.org/alsotang/defo.png?branch=master)](https://travis-ci.org/alsotang/defo)\n\nA method_missing lib for JavaScript.\n\nDefo announce 'default'.\n\n## Installation\n\n`npm install defo`\n\n## Quick Examples\n\nSet default value with a literal JS Object\n```javascript\nvar Defo = require('defo');\nvar defo = new Defo({a: 1, b: 2});\nconsole.log(defo.get('foo')); // => {a: 1, b: 2}\nconsole.log(defo.get('bar')); // => {a: 1, b: 2}\n```\n\nMore advanced, with a Function\n\n```javascript\nvar Defo = require('defo');\n\nvar defo = new Defo(function (key) {\n  return key + '!!!';\n});\n\nconsole.log(defo.get('Hello')); // => Hello!!!\n```\n\nTo see more(and more advanced) examples, please visit:\n\n[More Examples](https://github.com/alsotang/defo/blob/master/test/defo.test.js)\n\n## Documentation\n\n* #initialize\n* #set\n* #get\n* #to_object\n\n### #initialize\n\nDefo can be initialize when create a new Defo instance\n\nWith literal object:\n\n```javascript\nvar defo = new Defo({{a: 1, b: 2}});\nvar defo2 = new Defo([1, 2, 3]);\n```\n\nWith a function:\n\n```js\nvar defo = new Defo(function (key) {\n  // dosomething with key\n  return key;\n});\n```\n\n### #set && get\n\n```js\nvar defo = new Defo();\ndefo.set('person', {name: 'Alsotang', age: 21});\ndefo.get('person').height = 1.80;\nconsole.log(defo.get('person')); // => { name: 'Alsotang', age: 21, height: 1.8 }\n```\n\nchaining set\n\n```js\nvar defo = new Defo();\n\ndefo\n  .set('person', {name: 'Alsotang', age: 21})\n  .set('pet', {name: 'Piglet', age: 3});\ndefo.get('person').height = 1.80;\nconsole.log(defo.to_object());\n// output:\n// { person: { name: 'Alsotang', age: 21, height: 1.8 },\n//   pet: { name: 'Piglet', age: 3 } }\n```\n\nHash set\n```js\nvar defo = new Defo();\ndefo.set({\n  name: 'Alsotang',\n  age: 21\n});\ndefo.get('name').should.equal('Alsotang'); // => true\ndefo.get('age').should.equal(21); // => true\n```\n\n### #to_object\n\nto_object would convert your Defo to a JavaScript Object.\n\nThis method will create a new object instead of modify Defo object.\n\n```js\nvar person = new Defo();\nperson\n  .set('name', 'Alsotang')\n  .set('age', 21);\n\nvar pet = new Defo();\npet\n  .set('name', 'Piglet')\n  .set('age', 3);\n\nvar house = new Defo();\nhouse\n  .set('person', person)\n  .set('pet', pet);\n\nconsole.log(house.to_object());\n// output:\n// { person: { name: 'Alsotang', age: 21 },\n//   pet: { name: 'Piglet', age: 3 } }\n```\n\n## License\n\nMIT http://rem.mit-license.org","readmeFilename":"README.md","bugs":{"url":"https://github.com/alsotang/defo/issues"},"_id":"defo@0.2.5","dist":{"shasum":"e15b8b46c1f45f6474c959e49fea41a032cdc8bc","tarball":"https://registry.npmjs.org/defo/-/defo-0.2.5.tgz","integrity":"sha512-3/moUtoiCQbDtBVVNYoPzvKPxe8SIhFGEdAy0BhcDIYYeUwJxgjsqyJAdsICctTue5aEfsRtxkPvcn2QxSwQoQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCGqyGNtPcvNxcPfGQakHYL9u6wDfEINE+0k3/GPQwiQgIgNftvY9W8OXpzymQuyouriEDy8Px+36Mz4UhsjwiPPeI="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"alsotang","email":"alsotang@gmail.com"},"maintainers":[{"name":"alsotang","email":"alsotang@gmail.com"}]},"0.2.6":{"name":"defo","version":"0.2.6","description":"A method_missing lib for JavaScript","main":"defo.js","directories":{"test":"test"},"scripts":{},"repository":{"type":"git","url":"https://github.com/alsotang/defo"},"keywords":["method_missing","default-value"],"author":{"name":"Alsotang","email":"alsotang@gmail.com"},"license":"MIT","devDependencies":{"mocha":"~1.12.1","chai":"~1.7.2","blanket":"~1.1.5"},"engines":{"node":"*"},"readme":"# Defo\n\n[![Build Status](https://travis-ci.org/alsotang/defo.png?branch=master)](https://travis-ci.org/alsotang/defo)\n\nA method_missing lib for JavaScript.\n\nDefo pronounce 'default'.\n\n## Installation\n\n`npm install defo`\n\n## Quick Examples\n\nSet default value with a literal JS Object\n```javascript\nvar Defo = require('defo');\nvar defo = new Defo({a: 1, b: 2});\nconsole.log(defo.get('foo')); // => {a: 1, b: 2}\nconsole.log(defo.get('bar')); // => {a: 1, b: 2}\n```\n\nMore advanced, with a Function\n\n```javascript\nvar Defo = require('defo');\n\nvar defo = new Defo(function (key) {\n  return key + '!!!';\n});\n\nconsole.log(defo.get('Hello')); // => Hello!!!\n```\n\nTo see more(and more advanced) examples, please visit:\n\n[More Examples](https://github.com/alsotang/defo/blob/master/test/defo.test.js)\n\n## Documentation\n\n* #initialize\n* #set\n* #get\n* #to_object\n\n### #initialize\n\nDefo can be initialize when create a new Defo instance\n\nWith literal object:\n\n```javascript\nvar defo = new Defo({{a: 1, b: 2}});\nvar defo2 = new Defo([1, 2, 3]);\n```\n\nWith a function:\n\n```js\nvar defo = new Defo(function (key) {\n  // dosomething with key\n  return key;\n});\n```\n\n### #set && get\n\n```js\nvar defo = new Defo();\ndefo.set('person', {name: 'Alsotang', age: 21});\ndefo.get('person').height = 1.80;\nconsole.log(defo.get('person')); // => { name: 'Alsotang', age: 21, height: 1.8 }\n```\n\nchaining set\n\n```js\nvar defo = new Defo();\n\ndefo\n  .set('person', {name: 'Alsotang', age: 21})\n  .set('pet', {name: 'Piglet', age: 3});\ndefo.get('person').height = 1.80;\nconsole.log(defo.to_object());\n// output:\n// { person: { name: 'Alsotang', age: 21, height: 1.8 },\n//   pet: { name: 'Piglet', age: 3 } }\n```\n\nHash set\n```js\nvar defo = new Defo();\ndefo.set({\n  name: 'Alsotang',\n  age: 21\n});\ndefo.get('name').should.equal('Alsotang'); // => true\ndefo.get('age').should.equal(21); // => true\n```\n\n### #to_object\n\nto_object would convert your Defo to a JavaScript Object.\n\nThis method will create a new object instead of modify Defo object.\n\n```js\nvar person = new Defo();\nperson\n  .set('name', 'Alsotang')\n  .set('age', 21);\n\nvar pet = new Defo();\npet\n  .set('name', 'Piglet')\n  .set('age', 3);\n\nvar house = new Defo();\nhouse\n  .set('person', person)\n  .set('pet', pet);\n\nconsole.log(house.to_object());\n// output:\n// { person: { name: 'Alsotang', age: 21 },\n//   pet: { name: 'Piglet', age: 3 } }\n```\n\n## License\n\nMIT http://rem.mit-license.org","readmeFilename":"README.md","bugs":{"url":"https://github.com/alsotang/defo/issues"},"_id":"defo@0.2.6","dist":{"shasum":"72df8ceb17ea6fa9f59356bc21d35f4e78c0b047","tarball":"https://registry.npmjs.org/defo/-/defo-0.2.6.tgz","integrity":"sha512-te76y4N+B0A82wtJkra+txIW3fKtb4choJrF5nenVkzUgNZ1S7reVc5MvIvmsmq/C51s18zoPBfv9laWagwTyQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBGQniLzfHJ5NdtzgesIDfi5oeqSxvmxBs5MBRgoLBm9AiEAwKKzWHENcLVT7fO+pae33G/7b81oaneH9+EC3WyS6DU="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"alsotang","email":"alsotang@gmail.com"},"maintainers":[{"name":"alsotang","email":"alsotang@gmail.com"}]},"1.0.0":{"name":"defo","version":"1.0.0","description":"A method_missing lib for JavaScript","main":"defo.js","directories":{"test":"test"},"scripts":{},"repository":{"type":"git","url":"https://github.com/alsotang/defo"},"keywords":["method_missing","default-value"],"author":{"name":"Alsotang","email":"alsotang@gmail.com"},"license":"MIT","devDependencies":{"mocha":"~1.12.1","chai":"~1.7.2","blanket":"~1.1.5"},"engines":{"node":"*"},"readme":"# Defo\n\n[![Build Status](https://travis-ci.org/alsotang/defo.png?branch=master)](https://travis-ci.org/alsotang/defo)\n\nA method_missing lib for JavaScript.\n\nDefo pronounce 'default' without /t$/.\n\n## Installation\n\n`npm install defo`\n\n## Quick Examples\n\nSet default value with a literal JS Object\n```javascript\nvar Defo = require('defo');\nvar defo = new Defo({a: 1, b: 2});\nconsole.log(defo.get('foo')); // => {a: 1, b: 2}\nconsole.log(defo.get('bar')); // => {a: 1, b: 2}\n```\n\nMore advanced, with a Function\n\n```javascript\nvar Defo = require('defo');\n\nvar defo = new Defo(function (key) {\n  return key + '!!!';\n});\n\nconsole.log(defo.get('Hello')); // => Hello!!!\n```\n\nTo see more(and more advanced) examples, please visit:\n\n[More Examples](https://github.com/alsotang/defo/blob/master/test/defo.test.js)\n\n## Documentation\n\n* #initialize\n* #set\n* #get\n* #to_object\n\n### #initialize\n\nDefo can be initialize when create a new Defo instance\n\nWith literal object:\n\n```javascript\nvar defo = new Defo({{a: 1, b: 2}});\nvar defo2 = new Defo([1, 2, 3]);\n```\n\nWith a function:\n\n```js\nvar defo = new Defo(function (key) {\n  // dosomething with key\n  return key;\n});\n```\n\n### #set && get\n\n```js\nvar defo = new Defo();\ndefo.set('person', {name: 'Alsotang', age: 21});\ndefo.get('person').height = 1.80;\nconsole.log(defo.get('person')); // => { name: 'Alsotang', age: 21, height: 1.8 }\n```\n\nchaining set\n\n```js\nvar defo = new Defo();\n\ndefo\n  .set('person', {name: 'Alsotang', age: 21})\n  .set('pet', {name: 'Piglet', age: 3});\ndefo.get('person').height = 1.80;\nconsole.log(defo.to_object());\n// output:\n// { person: { name: 'Alsotang', age: 21, height: 1.8 },\n//   pet: { name: 'Piglet', age: 3 } }\n```\n\nHash set\n```js\nvar defo = new Defo();\ndefo.set({\n  name: 'Alsotang',\n  age: 21\n});\ndefo.get('name').should.equal('Alsotang'); // => true\ndefo.get('age').should.equal(21); // => true\n```\n\n### #to_object\n\nto_object would convert your Defo to a JavaScript Object.\n\nThis method will create a new object instead of modify Defo object.\n\n```js\nvar person = new Defo();\nperson\n  .set('name', 'Alsotang')\n  .set('age', 21);\n\nvar pet = new Defo();\npet\n  .set('name', 'Piglet')\n  .set('age', 3);\n\nvar house = new Defo();\nhouse\n  .set('person', person)\n  .set('pet', pet);\n\nconsole.log(house.to_object());\n// output:\n// { person: { name: 'Alsotang', age: 21 },\n//   pet: { name: 'Piglet', age: 3 } }\n```\n\n## License\n\nMIT http://rem.mit-license.org","readmeFilename":"README.md","bugs":{"url":"https://github.com/alsotang/defo/issues"},"_id":"defo@1.0.0","dist":{"shasum":"e5bb699f31bc5ed93df71baaf71df28f1d9cd0c4","tarball":"https://registry.npmjs.org/defo/-/defo-1.0.0.tgz","integrity":"sha512-nWav6w+f+5TIBeBU+5SMYYIcNs3kooqLJ8wWyUw4AYacKz6pSTl3HTmvs6c08g0dkMQivaKR4EsWy+ka58rrUA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCF/OTNYz0HL8wYaUZdk3ZYIlJNARXZFhyCnV3ax5gDLwIgKKqurpF467xJxSoZtUZrNwYSMEjyBkeMByBpXVOpL5c="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"alsotang","email":"alsotang@gmail.com"},"maintainers":[{"name":"alsotang","email":"alsotang@gmail.com"}]},"1.0.1":{"name":"defo","version":"1.0.1","description":"A method_missing(or Hash.new) lib for JavaScript","main":"defo.js","directories":{"test":"test"},"scripts":{},"repository":{"type":"git","url":"https://github.com/alsotang/defo"},"keywords":["method_missing","default-value"],"author":{"name":"Alsotang","email":"alsotang@gmail.com"},"license":"MIT","devDependencies":{"mocha":"~1.12.1","chai":"~1.7.2","blanket":"~1.1.5"},"engines":{"node":"*"},"readme":"# Defo\n\n[![Build Status](https://travis-ci.org/alsotang/defo.png?branch=master)](https://travis-ci.org/alsotang/defo)\n\nA method_missing(or Hash.new) lib for JavaScript.\n\nDefo pronounce 'default' without /t$/.\n\n## Installation\n\n`npm install defo`\n\n## Quick Examples\n\nSet default value with a literal JS Object\n```javascript\nvar Defo = require('defo');\nvar defo = new Defo({a: 1, b: 2});\nconsole.log(defo.get('foo')); // => {a: 1, b: 2}\nconsole.log(defo.get('bar')); // => {a: 1, b: 2}\n```\n\nMore advanced, with a Function\n\n```javascript\nvar Defo = require('defo');\n\nvar defo = new Defo(function (key) {\n  return key + '!!!';\n});\n\nconsole.log(defo.get('Hello')); // => Hello!!!\n```\n\nTo see more(and more advanced) examples, please visit:\n\n[More Examples](https://github.com/alsotang/defo/blob/master/test/defo.test.js)\n\n## Documentation\n\n* #initialize\n* #set\n* #get\n* #to_object\n\n### #initialize\n\nDefo can be initialize when create a new Defo instance\n\nWith literal object:\n\n```javascript\nvar defo = new Defo({{a: 1, b: 2}});\nvar defo2 = new Defo([1, 2, 3]);\n```\n\nWith a function:\n\n```js\nvar defo = new Defo(function (key) {\n  // dosomething with key\n  return key;\n});\n```\n\n### #set && get\n\n```js\nvar defo = new Defo();\ndefo.set('person', {name: 'Alsotang', age: 21});\ndefo.get('person').height = 1.80;\nconsole.log(defo.get('person')); // => { name: 'Alsotang', age: 21, height: 1.8 }\n```\n\nchaining set\n\n```js\nvar defo = new Defo();\n\ndefo\n  .set('person', {name: 'Alsotang', age: 21})\n  .set('pet', {name: 'Piglet', age: 3});\ndefo.get('person').height = 1.80;\nconsole.log(defo.to_object());\n// output:\n// { person: { name: 'Alsotang', age: 21, height: 1.8 },\n//   pet: { name: 'Piglet', age: 3 } }\n```\n\nHash set\n```js\nvar defo = new Defo();\ndefo.set({\n  name: 'Alsotang',\n  age: 21\n});\ndefo.get('name').should.equal('Alsotang'); // => true\ndefo.get('age').should.equal(21); // => true\n```\n\n### #to_object\n\nto_object would convert your Defo to a JavaScript Object.\n\nThis method will create a new object instead of modify Defo object.\n\n```js\nvar person = new Defo();\nperson\n  .set('name', 'Alsotang')\n  .set('age', 21);\n\nvar pet = new Defo();\npet\n  .set('name', 'Piglet')\n  .set('age', 3);\n\nvar house = new Defo();\nhouse\n  .set('person', person)\n  .set('pet', pet);\n\nconsole.log(house.to_object());\n// output:\n// { person: { name: 'Alsotang', age: 21 },\n//   pet: { name: 'Piglet', age: 3 } }\n```\n\n## License\n\nMIT http://rem.mit-license.org","readmeFilename":"README.md","bugs":{"url":"https://github.com/alsotang/defo/issues"},"_id":"defo@1.0.1","dist":{"shasum":"c4dc17d6249ecbfabbc181c10309bb69729b2465","tarball":"https://registry.npmjs.org/defo/-/defo-1.0.1.tgz","integrity":"sha512-KQ3tlOc+0byDHDxdWsIT8Nd4VEiPYaNyATa7y2OxH0pC4PwxE9U8G814uGEgSbFVIq8c3w7+SnztgZHTXclsbw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICtIAm1EkmsdPkCcnpwJDAzOOdi5oLJOQVaW0i8hO8g2AiEA/30t/T4zW9r8QlquIX+rz/DTCA8/GVHWQJZwW6eaY80="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"alsotang","email":"alsotang@gmail.com"},"maintainers":[{"name":"alsotang","email":"alsotang@gmail.com"}]},"1.0.2":{"name":"defo","version":"1.0.2","description":"A method_missing(or Hash.new) lib for JavaScript","main":"defo.js","directories":{"test":"test"},"scripts":{},"repository":{"type":"git","url":"https://github.com/alsotang/defo"},"keywords":["method_missing","default-value"],"author":{"name":"Alsotang","email":"alsotang@gmail.com"},"license":"MIT","devDependencies":{"mocha":"~1.12.1","chai":"~1.7.2","blanket":"~1.1.5"},"engines":{"node":"*"},"readme":"# Defo\n\n[![Build Status](https://travis-ci.org/alsotang/defo.png?branch=master)](https://travis-ci.org/alsotang/defo)\n\nA method_missing(or Hash.new) lib for JavaScript.\n\nDefo pronounce 'default' without /t$/.\n\n## Installation\n\n`npm install defo`\n\n## Quick Examples\n\nSet default value with a literal JS Object\n```javascript\nvar Defo = require('defo');\nvar defo = new Defo({a: 1, b: 2});\nconsole.log(defo.get('foo')); // => {a: 1, b: 2}\nconsole.log(defo.get('bar')); // => {a: 1, b: 2}\n```\n\nMore advanced, with a Function\n\n```javascript\nvar Defo = require('defo');\n\nvar defo = new Defo(function (key) {\n  return key + '!!!';\n});\n\nconsole.log(defo.get('Hello')); // => Hello!!!\n```\n\nTo see more(and more advanced) examples, please visit:\n\n[More Examples](https://github.com/alsotang/defo/blob/master/test/defo.test.js)\n\n## Documentation\n\n* #initialize\n* #set\n* #get\n* #to_object\n\n### #initialize\n\nDefo can be initialize when create a new Defo instance\n\nWith literal object:\n\n```javascript\nvar defo = new Defo({{a: 1, b: 2}});\nvar defo2 = new Defo([1, 2, 3]);\n```\n\nWith a function:\n\n```js\nvar defo = new Defo(function (key) {\n  // dosomething with key\n  return key;\n});\n```\n\n### #set && get\n\n```js\nvar defo = new Defo();\ndefo.set('person', {name: 'Alsotang', age: 21});\ndefo.get('person').height = 1.80;\nconsole.log(defo.get('person')); // => { name: 'Alsotang', age: 21, height: 1.8 }\n```\n\nchaining set\n\n```js\nvar defo = new Defo();\n\ndefo\n  .set('person', {name: 'Alsotang', age: 21})\n  .set('pet', {name: 'Piglet', age: 3});\ndefo.get('person').height = 1.80;\nconsole.log(defo.to_object());\n// output:\n// { person: { name: 'Alsotang', age: 21, height: 1.8 },\n//   pet: { name: 'Piglet', age: 3 } }\n```\n\nHash set\n```js\nvar defo = new Defo();\ndefo.set({\n  name: 'Alsotang',\n  age: 21\n});\ndefo.get('name').should.equal('Alsotang'); // => true\ndefo.get('age').should.equal(21); // => true\n```\n\n### #to_object\n\nto_object would convert your Defo to a JavaScript Object.\n\nThis method will create a new object instead of modify Defo object.\n\n```js\nvar person = new Defo();\nperson\n  .set('name', 'Alsotang')\n  .set('age', 21);\n\nvar pet = new Defo();\npet\n  .set('name', 'Piglet')\n  .set('age', 3);\n\nvar house = new Defo();\nhouse\n  .set('person', person)\n  .set('pet', pet);\n\nconsole.log(house.to_object());\n// output:\n// { person: { name: 'Alsotang', age: 21 },\n//   pet: { name: 'Piglet', age: 3 } }\n```\n\n## Why I create Defo\n\nIn my work, there are lots of situations to deal with data structure.\n\nFor example, there is some rows from SQL databse:\n\n```js\nvar ROWS = [\n// Name, Height, Weight, Country\n  [\"Alsotang\", 180, 60, \"Chinese\"],\n  [\"YB\", 165, 50, \"Chinese\"],\n  [\"Jack\", 179, 70, \"American\"],\n  [\"Lucy\", 170, 100, \"American\"]\n];\n```\n\nand I need to convert it to below:\n\n```js\nvar RESULTS = {\n  \"Chinese\": {\n    \"Alsotang\": {\n      \"Height\": 180,\n      \"Weight\": 60\n    },\n    \"YB\": {\n      \"Height\": 165,\n      \"Weight\": 50\n    }\n  },\n  \"American\": {\n    \"Jack\": {\n      \"Height\": 179,\n      \"Weight\": 70\n    },\n    \"Lucy\": {\n      \"Height\": 170,\n      \"Weight\": 100\n    }\n  }\n};\n```\n\nWith Defo, I can just write:\n\n```js\nvar result = new Defo( // in this Defo, key would be Chinese or American\n  new Defo( // would be Alsotang or Jack in this\n    new Defo() // Height or Weight\n    )\n  );\nROWS.forEach(function (person) {\n  var name = person[0],\n    height = person[1],\n    weight = person[2],\n    country = person[3];\n  result.get(country).get(name)\n  .set('Height', height)\n  .set('Weight', weight);\n});\nresult.to_object().should.eql(RESULTS); // => true\n```\n\nAnd it works! Otherwise the implement code is ugly, especially when the data structure is not such simple.\n\n## License\n\nMIT http://rem.mit-license.org","readmeFilename":"README.md","bugs":{"url":"https://github.com/alsotang/defo/issues"},"_id":"defo@1.0.2","dist":{"shasum":"58fbf265a37c954efa44eb624888e9fdd5abc9cc","tarball":"https://registry.npmjs.org/defo/-/defo-1.0.2.tgz","integrity":"sha512-Z3q4LVYbMQBzR9jou6kSPDf/iGek7OZvkSYiVmlz0M+mJotcArg8B6pRCK4Xc/CsFL+FSBh53HLLLIfWPdwBjg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBUYkArqIrfYjw3xtpxuh4dICAtFfRivCHfSaarpk9RxAiEAmrDMtK+62AqCoEbc36lFuQE+GZWYzQDBjh2fT1dYiEc="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"alsotang","email":"alsotang@gmail.com"},"maintainers":[{"name":"alsotang","email":"alsotang@gmail.com"}]},"1.1.0":{"name":"defo","version":"1.1.0","description":"A method_missing(or Hash.new) lib for JavaScript","main":"defo.js","directories":{"test":"test"},"scripts":{},"repository":{"type":"git","url":"https://github.com/alsotang/defo"},"keywords":["method_missing","default-value"],"author":{"name":"Alsotang","email":"alsotang@gmail.com"},"license":"MIT","devDependencies":{"mocha":"~1.12.1","chai":"~1.7.2","blanket":"~1.1.5"},"engines":{"node":"*"},"readme":"# Defo\n\n[![Build Status](https://travis-ci.org/alsotang/defo.png?branch=master)](https://travis-ci.org/alsotang/defo)\n\nA method_missing(or Hash.new) lib for JavaScript.\n\nDefo pronounce 'default' without /t$/.\n\n## Installation\n\n`npm install defo`\n\n## Quick Examples\n\nSet default value with a literal JS Object\n```javascript\nvar Defo = require('defo');\nvar defo = new Defo({a: 1, b: 2});\nconsole.log(defo.get('foo')); // => {a: 1, b: 2}\nconsole.log(defo.get('bar')); // => {a: 1, b: 2}\n```\n\nMore advanced, with a Function\n\n```javascript\nvar Defo = require('defo');\n\nvar defo = new Defo(function (key) {\n  return key + '!!!';\n});\n\nconsole.log(defo.get('Hello')); // => Hello!!!\n```\n\nTo see more(and more advanced) examples, please visit:\n\n[More Examples](https://github.com/alsotang/defo/blob/master/test/defo.test.js)\n\n## Documentation\n\n* #initialize\n* #set\n* #get\n* #to_object\n\n### #initialize\n\nDefo can be initialize when create a new Defo instance\n\nWith literal object:\n\n```javascript\nvar defo = new Defo({{a: 1, b: 2}});\nvar defo2 = new Defo([1, 2, 3]);\n```\n\nWith a function:\n\n```js\nvar defo = new Defo(function (key) {\n  // dosomething with key\n  return key;\n});\n```\n\n### #set && get\n\n```js\nvar defo = new Defo();\ndefo.set('person', {name: 'Alsotang', age: 21});\ndefo.get('person').height = 1.80;\nconsole.log(defo.get('person')); // => { name: 'Alsotang', age: 21, height: 1.8 }\n```\n\nchaining set\n\n```js\nvar defo = new Defo();\n\ndefo\n  .set('person', {name: 'Alsotang', age: 21})\n  .set('pet', {name: 'Piglet', age: 3});\ndefo.get('person').height = 1.80;\nconsole.log(defo.to_object());\n// output:\n// { person: { name: 'Alsotang', age: 21, height: 1.8 },\n//   pet: { name: 'Piglet', age: 3 } }\n```\n\nHash set\n```js\nvar defo = new Defo();\ndefo.set({\n  name: 'Alsotang',\n  age: 21\n});\ndefo.get('name').should.equal('Alsotang'); // => true\ndefo.get('age').should.equal(21); // => true\n```\n\n### #to_object\n\nto_object would convert your Defo to a JavaScript Object.\n\nThis method will create a new object instead of modify Defo object.\n\n```js\nvar person = new Defo();\nperson\n  .set('name', 'Alsotang')\n  .set('age', 21);\n\nvar pet = new Defo();\npet\n  .set('name', 'Piglet')\n  .set('age', 3);\n\nvar house = new Defo();\nhouse\n  .set('person', person)\n  .set('pet', pet);\n\nconsole.log(house.to_object());\n// output:\n// { person: { name: 'Alsotang', age: 21 },\n//   pet: { name: 'Piglet', age: 3 } }\n```\n\n## Why I create Defo\n\nIn my work, there are lots of situations to deal with data structure.\n\nFor example, there is some rows from SQL databse:\n\n```js\nvar ROWS = [\n// Name, Height, Weight, Country\n  [\"Alsotang\", 180, 60, \"Chinese\"],\n  [\"YB\", 165, 50, \"Chinese\"],\n  [\"Jack\", 179, 70, \"American\"],\n  [\"Lucy\", 170, 100, \"American\"]\n];\n```\n\nand I need to convert it to below:\n\n```js\nvar RESULTS = {\n  \"Chinese\": {\n    \"Alsotang\": {\n      \"Height\": 180,\n      \"Weight\": 60\n    },\n    \"YB\": {\n      \"Height\": 165,\n      \"Weight\": 50\n    }\n  },\n  \"American\": {\n    \"Jack\": {\n      \"Height\": 179,\n      \"Weight\": 70\n    },\n    \"Lucy\": {\n      \"Height\": 170,\n      \"Weight\": 100\n    }\n  }\n};\n```\n\nWith Defo, I can just write:\n\n```js\nvar result = new Defo( // in this Defo, key would be Chinese or American\n  new Defo( // would be Alsotang or Jack in this\n    new Defo() // Height or Weight\n    )\n  );\nROWS.forEach(function (person) {\n  var name = person[0],\n    height = person[1],\n    weight = person[2],\n    country = person[3];\n  result.get(country).get(name)\n  .set('Height', height)\n  .set('Weight', weight);\n});\nresult.to_object().should.eql(RESULTS); // => true\n```\n\nAnd it works! Otherwise the implement code is ugly, especially when the data structure is not such simple.\n\n## License\n\nMIT http://rem.mit-license.org","readmeFilename":"README.md","bugs":{"url":"https://github.com/alsotang/defo/issues"},"_id":"defo@1.1.0","dist":{"shasum":"23dde7015f80244a13b05e36a3ddeb9fefaae191","tarball":"https://registry.npmjs.org/defo/-/defo-1.1.0.tgz","integrity":"sha512-CrmY6CfHy5wrenyb5pJXj5+hnXT9CSRJ6NGDV8V2WdQPE0E8ZtJH+Sd6nz6lEVP64P4mlUdJAQDqF/du68nGYg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD+sA+XaJQaHK7Yq3GOD2j9C+n/eCi7Ady3UuikHpLJnwIhAPwa3VPOAdtUt1uFawojwoFHxio3yZreFsnyQL773XRg"}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"alsotang","email":"alsotang@gmail.com"},"maintainers":[{"name":"alsotang","email":"alsotang@gmail.com"}]},"2.1.0":{"name":"defo","version":"2.1.0","description":"A method_missing(or Hash.new) lib for JavaScript","main":"defo.js","directories":{"test":"test"},"scripts":{},"repository":{"type":"git","url":"https://github.com/alsotang/defo"},"keywords":["method_missing","default-value"],"author":{"name":"Alsotang","email":"alsotang@gmail.com"},"license":"MIT","devDependencies":{"mocha":"~1.12.1","chai":"~1.7.2","blanket":"~1.1.5"},"engines":{"node":"*"},"readme":"# Defo\n\n[![Build Status](https://travis-ci.org/alsotang/defo.png?branch=master)](https://travis-ci.org/alsotang/defo)\n\nA method_missing(or Hash.new) lib for JavaScript.\n\nDefo pronounce 'default' without /t$/.\n\n## Installation\n\n`npm install defo`\n\n## Quick Examples\n\nSet default value with a literal JS Object\n```javascript\nvar Defo = require('defo');\nvar defo = new Defo({a: 1, b: 2});\nconsole.log(defo.get('foo')); // => {a: 1, b: 2}\nconsole.log(defo.get('bar')); // => {a: 1, b: 2}\n```\n\nMore advanced, with a Function\n\n```javascript\nvar Defo = require('defo');\n\nvar defo = new Defo(function (key) {\n  return key + '!!!';\n});\n\nconsole.log(defo.get('Hello')); // => Hello!!!\n```\n\nTo see more(and more advanced) examples, please visit:\n\n[More Examples](https://github.com/alsotang/defo/blob/master/test/defo.test.js)\n\n## Documentation\n\n* #initialize\n* #set\n* #get\n* #to_object\n\n### #initialize\n\nDefo can be initialize when create a new Defo instance\n\nWith literal object:\n\n```javascript\nvar defo = new Defo({a: 1, b: 2});\nvar defo2 = new Defo([1, 2, 3]);\n```\n\nWith a function:\n\n```js\nvar defo = new Defo(function (key) {\n  var value = ...// dosomething with key\n  return value;\n});\n```\n\n### #set && get\n\n```js\nvar defo = new Defo();\ndefo.set('person', {name: 'Alsotang', age: 21});\ndefo.get('person').height = 1.80;\nconsole.log(defo.get('person')); // => { name: 'Alsotang', age: 21, height: 1.8 }\n```\n\nchaining set\n\n```js\nvar defo = new Defo();\n\ndefo\n  .set('person', {name: 'Alsotang', age: 21})\n  .set('pet', {name: 'Piglet', age: 3});\ndefo.get('person').height = 1.80;\nconsole.log(defo.to_object());\n// output:\n// { person: { name: 'Alsotang', age: 21, height: 1.8 },\n//   pet: { name: 'Piglet', age: 3 } }\n```\n\nHash set\n```js\nvar defo = new Defo();\ndefo.set({\n  name: 'Alsotang',\n  age: 21\n});\ndefo.get('name').should.equal('Alsotang'); // => true\ndefo.get('age').should.equal(21); // => true\n```\n\n### #to_object\n\nto_object would convert your Defo to a JavaScript Object.\n\nThis method will create a new object instead of modify Defo object.\n\n```js\nvar person = new Defo();\nperson\n  .set('name', 'Alsotang')\n  .set('age', 21);\n\nvar pet = new Defo();\npet\n  .set('name', 'Piglet')\n  .set('age', 3);\n\nvar house = new Defo();\nhouse\n  .set('person', person)\n  .set('pet', pet);\n\nconsole.log(house.to_object());\n// output:\n// { person: { name: 'Alsotang', age: 21 },\n//   pet: { name: 'Piglet', age: 3 } }\n```\n\n## Why I create Defo\n\nIn my work, there are lots of situations to deal with data structure.\n\nFor example, there is some rows from SQL databse:\n\n```js\nvar ROWS = [\n// Name, Height, Weight, Country\n  [\"Alsotang\", 180, 60, \"Chinese\"],\n  [\"YB\", 165, 50, \"Chinese\"],\n  [\"Jack\", 179, 70, \"American\"],\n  [\"Lucy\", 170, 100, \"American\"]\n];\n```\n\nand I need to convert it to below:\n\n```js\nvar RESULTS = {\n  \"Chinese\": {\n    \"Alsotang\": {\n      \"Height\": 180,\n      \"Weight\": 60\n    },\n    \"YB\": {\n      \"Height\": 165,\n      \"Weight\": 50\n    }\n  },\n  \"American\": {\n    \"Jack\": {\n      \"Height\": 179,\n      \"Weight\": 70\n    },\n    \"Lucy\": {\n      \"Height\": 170,\n      \"Weight\": 100\n    }\n  }\n};\n```\n\nWith Defo, I can just write:\n\n```js\nvar result = new Defo( // in this Defo, key would be Chinese or American\n  new Defo( // would be Alsotang or Jack in this\n    new Defo() // Height or Weight\n    )\n  );\nROWS.forEach(function (person) {\n  var name = person[0],\n    height = person[1],\n    weight = person[2],\n    country = person[3];\n  result.get(country).get(name)\n  .set('Height', height)\n  .set('Weight', weight);\n});\nresult.to_object().should.eql(RESULTS); // => true\n```\n\nAnd it works! Otherwise the implement code is ugly, especially when the data structure is not such simple.\n\n## License\n\nMIT http://rem.mit-license.org","readmeFilename":"README.md","bugs":{"url":"https://github.com/alsotang/defo/issues"},"_id":"defo@2.1.0","dist":{"shasum":"4385a486bdd6bdc41910a176452cb178057f8142","tarball":"https://registry.npmjs.org/defo/-/defo-2.1.0.tgz","integrity":"sha512-7Rv6rqjdP5h+PT23Y5/M4ZuDgs6V8XnclU2K1hhZYksIegi34ITjg0YmPpRY3IKBGldFerSV1TmqoU1PBk9Z4Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICIX+urtjy/cPUyNqLic912CI1SISxmRh/cAXKloqxUOAiEAodqw4YtqpOp2W0UA3JKw7lxoOLnz4qUy+DTpxe2EqJA="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"alsotang","email":"alsotang@gmail.com"},"maintainers":[{"name":"alsotang","email":"alsotang@gmail.com"}]},"2.1.1":{"name":"defo","version":"2.1.1","description":"A method_missing(or Hash.new) lib for JavaScript","main":"defo.js","directories":{"test":"test"},"scripts":{},"repository":{"type":"git","url":"https://github.com/alsotang/defo"},"keywords":["method_missing","default-value"],"author":{"name":"Alsotang","email":"alsotang@gmail.com"},"license":"MIT","devDependencies":{"mocha":"~1.12.1","chai":"~1.7.2","blanket":"~1.1.5"},"engines":{"node":"*"},"readme":"# Defo\n\n[![Build Status](https://travis-ci.org/alsotang/defo.png?branch=master)](https://travis-ci.org/alsotang/defo)\n\nA method_missing(or Hash.new) lib for JavaScript.\n\nDefo pronounce 'default' without /t$/.\n\n## Installation\n\n`npm install defo`\n\n## Quick Examples\n\nSet default value with a literal JS Object\n```javascript\nvar Defo = require('defo');\nvar defo = new Defo({a: 1, b: 2});\nconsole.log(defo.get('notExist')); // => {a: 1, b: 2}\nconsole.log(defo.get('lol<3')); // => {a: 1, b: 2}\n```\n\nMore advanced, with a Function\n\n```javascript\nvar Defo = require('defo');\n\nvar defo = new Defo(function (key) {\n  return key + '!!!';\n});\n\nconsole.log(defo.get('Hello')); // => Hello!!!\n```\n\nTo see more(and more advanced) examples, please visit:\n\n[More Examples](https://github.com/alsotang/defo/blob/master/test/defo.test.js)\n\n## Documentation\n\n* #initialize\n* #set\n* #get\n* #toObject\n\n### #initialize\n\nDefo can be initialized when create a new Defo instance\n\nWith literal object:\n\n```javascript\nvar defo = new Defo({a: 1, b: 2});\nvar defo2 = new Defo([1, 2, 3]);\n```\n\nWith a function:\n\n```js\nvar defo = new Defo(function (key) {\n  var value = ...// dosomething with key\n  return value;\n});\n```\n\n### #set && get\n\n```js\nvar defo = new Defo();\ndefo.set('person', {name: 'Alsotang', age: 21});\ndefo.get('person').height = 1.80;\nconsole.log(defo.get('person')); // => { name: 'Alsotang', age: 21, height: 1.8 }\nconsole.log(defo.get('<3')); // => undefined\n```\n\nchaining set\n\n```js\nvar defo = new Defo();\n\ndefo\n  .set('person', {name: 'Alsotang', age: 21})\n  .set('pet', {name: 'Piglet', age: 3});\ndefo.get('person').height = 1.80;\nconsole.log(defo.toObject());\n// output:\n// { person: { name: 'Alsotang', age: 21, height: 1.8 },\n//   pet: { name: 'Piglet', age: 3 } }\n```\n\nset with a Hash\n```js\nvar defo = new Defo();\ndefo.set({\n  name: 'Alsotang',\n  age: 21\n});\ndefo.get('name').should.equal('Alsotang'); // => true\ndefo.get('age').should.equal(21); // => true\n```\n\n### #toObject\n\ntoObject would convert your Defo to a JavaScript Object.\n\nThis method will create a new object instead of modify Defo object.\n\n```js\nvar person = new Defo();\nperson\n  .set('name', 'Alsotang')\n  .set('age', 21);\n\nvar pet = new Defo();\npet\n  .set('name', 'Piglet')\n  .set('age', 3);\n\nvar house = new Defo();\nhouse\n  .set('person', person)\n  .set('pet', pet);\n\nconsole.log(house.toObject());\n// output:\n// { person: { name: 'Alsotang', age: 21 },\n//   pet: { name: 'Piglet', age: 3 } }\n```\n\n## Why I create Defo\n\nIn my work, there are lots of situations to deal with data structure transformation.\n\nFor example, there is some rows from SQL database:\n\n```js\nvar ROWS = [\n// Name, Height, Weight, Country\n  [\"Alsotang\", 180, 60, \"Chinese\"],\n  [\"YB\", 165, 50, \"Chinese\"],\n  [\"Jack\", 179, 70, \"American\"],\n  [\"Lucy\", 170, 100, \"American\"]\n];\n```\n\nand I need to transform it to below:\n\n```js\nvar RESULTS = {\n  \"Chinese\": {\n    \"Alsotang\": {\n      \"Height\": 180,\n      \"Weight\": 60\n    },\n    \"YB\": {\n      \"Height\": 165,\n      \"Weight\": 50\n    }\n  },\n  \"American\": {\n    \"Jack\": {\n      \"Height\": 179,\n      \"Weight\": 70\n    },\n    \"Lucy\": {\n      \"Height\": 170,\n      \"Weight\": 100\n    }\n  }\n};\n```\n\nWith Defo, I can just write:\n\n```js\nvar result = new Defo( // in this Defo, key would be Chinese or American\n  new Defo( // would be Alsotang or Jack in this\n    new Defo() // Height or Weight\n    )\n  );\nROWS.forEach(function (person) {\n  var name = person[0],\n    height = person[1],\n    weight = person[2],\n    country = person[3];\n  result.get(country).get(name)\n  .set('Height', height)\n  .set('Weight', weight);\n});\nresult.toObject().should.eql(RESULTS); // => true\n```\n\nAnd it works! Otherwise the implement code is ugly, especially when the data structure is not such simple.\n\n## License\n\nMIT http://rem.mit-license.org","readmeFilename":"README.md","bugs":{"url":"https://github.com/alsotang/defo/issues"},"_id":"defo@2.1.1","dist":{"shasum":"3afa7a3dbbb39ebb263caec2a489446f164dfa12","tarball":"https://registry.npmjs.org/defo/-/defo-2.1.1.tgz","integrity":"sha512-SS7Jl+VNx/qaR63OL1ha+42U6e055Vu/rghSNVnNFxEH6ZSQO38kZcqQiadtbaelv8Gd7j0Kr3rFNBW8gVFZaA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCbQdH45QmPtf1xXR4SP/SeLPl5uwvYFqqEvjtf6JOhoQIgCi99ay738SUhXxp4Xv/Is3Ze9gDyCKjYTLdXWdnTNRY="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"alsotang","email":"alsotang@gmail.com"},"maintainers":[{"name":"alsotang","email":"alsotang@gmail.com"}]},"2.1.2":{"name":"defo","version":"2.1.2","description":"A method_missing(or Hash.new) lib for JavaScript","main":"defo.js","directories":{"test":"test"},"scripts":{},"repository":{"type":"git","url":"https://github.com/alsotang/defo"},"keywords":["method_missing","default-value"],"author":{"name":"Alsotang","email":"alsotang@gmail.com"},"license":"MIT","devDependencies":{"mocha":"~1.12.1","chai":"~1.7.2","blanket":"~1.1.5"},"engines":{"node":"*"},"readme":"# Defo\n\n[![Build Status](https://travis-ci.org/alsotang/defo.png?branch=master)](https://travis-ci.org/alsotang/defo)\n\nA method_missing(or Hash.new) lib for JavaScript.\n\nDefo pronounce 'default' without /t$/.\n\n## Installation\n\n`npm install defo`\n\n## Quick Examples\n\nSet default value with a literal JS Object\n```javascript\nvar Defo = require('defo');\nvar defo = new Defo({a: 1, b: 2});\nconsole.log(defo.get('notExist')); // => {a: 1, b: 2}\nconsole.log(defo.get('lol<3')); // => {a: 1, b: 2}\n```\n\nMore advanced, with a Function\n\n```javascript\nvar Defo = require('defo');\n\nvar defo = new Defo(function (key) {\n  return key + '!!!';\n});\n\nconsole.log(defo.get('Hello')); // => Hello!!!\n```\n\nTo see more(and more advanced) examples, please visit:\n\n[More Examples](https://github.com/alsotang/defo/blob/master/test/defo.test.js)\n\n## Documentation\n\n* #initialize\n* #set\n* #get\n* #toObject\n\n### #initialize\n\nDefo can be initialized when create a new Defo instance\n\nWith literal object:\n\n```javascript\nvar defo = new Defo({a: 1, b: 2});\nvar defo2 = new Defo([1, 2, 3]);\n```\n\nWith a function:\n\n```js\nvar defo = new Defo(function (key) {\n  var value = ...// dosomething with key\n  return value;\n});\n```\n\n### #set && get\n\n```js\nvar defo = new Defo();\ndefo.set('person', {name: 'Alsotang', age: 21});\ndefo.get('person').height = 1.80;\nconsole.log(defo.get('person')); // => { name: 'Alsotang', age: 21, height: 1.8 }\nconsole.log(defo.get('<3')); // => undefined\n```\n\nchaining set\n\n```js\nvar defo = new Defo();\n\ndefo\n  .set('person', {name: 'Alsotang', age: 21})\n  .set('pet', {name: 'Piglet', age: 3});\ndefo.get('person').height = 1.80;\nconsole.log(defo.toObject());\n// output:\n// { person: { name: 'Alsotang', age: 21, height: 1.8 },\n//   pet: { name: 'Piglet', age: 3 } }\n```\n\nset with a Hash\n```js\nvar defo = new Defo();\ndefo.set({\n  name: 'Alsotang',\n  age: 21\n});\ndefo.get('name').should.equal('Alsotang'); // => true\ndefo.get('age').should.equal(21); // => true\n```\n\n### #toObject\n\ntoObject would convert your Defo to a JavaScript Object.\n\nThis method will create a new object instead of modify Defo object.\n\n```js\nvar person = new Defo();\nperson\n  .set('name', 'Alsotang')\n  .set('age', 21);\n\nvar pet = new Defo();\npet\n  .set('name', 'Piglet')\n  .set('age', 3);\n\nvar house = new Defo();\nhouse\n  .set('person', person)\n  .set('pet', pet);\n\nconsole.log(house.toObject());\n// output:\n// { person: { name: 'Alsotang', age: 21 },\n//   pet: { name: 'Piglet', age: 3 } }\n```\n\n## Memoize\n\n```js\nvar fibonacci = new Defo(function (key) {\n  if (key === 1 || key === 2) {\n    this.set(key, 1);\n    return this.get(key);\n  }\n  this.set(key, this.get(key - 1) + this.get(key - 2));\n  return this.get(key);\n});\nfibonacci.get(15).should.equal(610); // 610 is 15-th of fibonacci sequence\nfibonacci.get(20).should.equal(6765);\nfibonacci._backed.should.eql({ '1': 1, '2': 1, '3': 2, '4': 3,\n  '5': 5, '6': 8, '7': 13, '8': 21, '9': 34, '10': 55,\n  '11': 89, '12': 144, '13': 233, '14': 377, '15': 610,\n  '16': 987, '17': 1597, '18': 2584, '19': 4181,\n  '20': 6765 });\n```\n\n## Why I create Defo\n\nIn my work, there are lots of situations to deal with data structure transformation.\n\nFor example, there is some rows from SQL database:\n\n```js\nvar ROWS = [\n// Name, Height, Weight, Country\n  [\"Alsotang\", 180, 60, \"Chinese\"],\n  [\"YB\", 165, 50, \"Chinese\"],\n  [\"Jack\", 179, 70, \"American\"],\n  [\"Lucy\", 170, 100, \"American\"]\n];\n```\n\nand I need to transform it to below:\n\n```js\nvar RESULTS = {\n  \"Chinese\": {\n    \"Alsotang\": {\n      \"Height\": 180,\n      \"Weight\": 60\n    },\n    \"YB\": {\n      \"Height\": 165,\n      \"Weight\": 50\n    }\n  },\n  \"American\": {\n    \"Jack\": {\n      \"Height\": 179,\n      \"Weight\": 70\n    },\n    \"Lucy\": {\n      \"Height\": 170,\n      \"Weight\": 100\n    }\n  }\n};\n```\n\nWith Defo, I can just write:\n\n```js\nvar result = new Defo( // in this Defo, key would be Chinese or American\n  new Defo( // would be Alsotang or Jack in this\n    new Defo() // Height or Weight\n    )\n  );\nROWS.forEach(function (person) {\n  var name = person[0],\n    height = person[1],\n    weight = person[2],\n    country = person[3];\n  result.get(country).get(name)\n  .set('Height', height)\n  .set('Weight', weight);\n});\nresult.toObject().should.eql(RESULTS); // => true\n```\n\nAnd it works! Otherwise the implement code is ugly, especially when the data structure is not such simple.\n\n## License\n\nMIT http://rem.mit-license.org","readmeFilename":"README.md","bugs":{"url":"https://github.com/alsotang/defo/issues"},"_id":"defo@2.1.2","dist":{"shasum":"b0fde2048153943d014220962ed7a640abfed04c","tarball":"https://registry.npmjs.org/defo/-/defo-2.1.2.tgz","integrity":"sha512-gYIvCNulmTJ2BokZ7Q5Y11uZAH6WzIDolGyfqtEZc7+jhnJHeqbRYXK6wo7Rcf1Osa1hvKAO9VFcR2v8GCspNQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB6frHTz2sq6AWEpdOcQurTiCmHN3RkbFPB/HIC4YmjmAiAHhIjEmu+cun6id0MJCqcqnGQLs9+xDlhLfMgetRMN8w=="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"alsotang","email":"alsotang@gmail.com"},"maintainers":[{"name":"alsotang","email":"alsotang@gmail.com"}]},"2.1.3":{"name":"defo","version":"2.1.3","description":"A method_missing(or Hash.new) lib for JavaScript","main":"defo.js","directories":{"test":"test"},"scripts":{},"repository":{"type":"git","url":"https://github.com/alsotang/defo"},"keywords":["method_missing","default-value"],"author":{"name":"Alsotang","email":"alsotang@gmail.com"},"license":"MIT","devDependencies":{"mocha":"~1.12.1","chai":"~1.7.2","blanket":"~1.1.5"},"engines":{"node":"*"},"readme":"# Defo\n\n[![Build Status](https://travis-ci.org/alsotang/defo.png?branch=master)](https://travis-ci.org/alsotang/defo)\n\nA method_missing(or Hash.new) lib for JavaScript.\n\nDefo pronounce 'default' without /t$/.\n\n## Installation\n\n`npm install defo`\n\n## Quick Examples\n\nSet default value with a literal JS Object\n```javascript\nvar Defo = require('defo');\nvar defo = new Defo('@@@');\nconsole.log(defo.get('notExist')); // => '@@@'\nconsole.log(defo.get('lol<3')); // => '@@@'\n```\n\nMore advanced, with a Function\n\n```javascript\nvar Defo = require('defo');\n\nvar defo = new Defo(function (key) {\n  return key + '!!!';\n});\n\nconsole.log(defo.get('Hello')); // => Hello!!!\n```\n\nTo see more(and more advanced) examples, please visit:\n\n[More Examples](https://github.com/alsotang/defo/blob/master/test/defo.test.js)\n\n## Documentation\n\n* #initialize\n* #set\n* #get\n* #toObject\n\n### #initialize\n\nDefo can be initialized when create a new Defo instance\n\nWith literal object:\n\n```javascript\nvar defo = new Defo({a: 1, b: 2});\nvar defo2 = new Defo([1, 2, 3]);\n```\n\nWith a function:\n\n```js\nvar defo = new Defo(function (key) {\n  var value = ...// dosomething with key\n  return value;\n});\n```\n\n### #set && get\n\n```js\nvar defo = new Defo();\ndefo.set('person', {name: 'Alsotang', age: 21});\ndefo.get('person').height = 1.80;\nconsole.log(defo.get('person')); // => { name: 'Alsotang', age: 21, height: 1.8 }\nconsole.log(defo.get('<3')); // => undefined\n```\n\nchaining set\n\n```js\nvar defo = new Defo();\n\ndefo\n  .set('person', {name: 'Alsotang', age: 21})\n  .set('pet', {name: 'Piglet', age: 3});\ndefo.get('person').height = 1.80;\nconsole.log(defo.toObject());\n// output:\n// { person: { name: 'Alsotang', age: 21, height: 1.8 },\n//   pet: { name: 'Piglet', age: 3 } }\n```\n\nset with a Hash\n```js\nvar defo = new Defo();\ndefo.set({\n  name: 'Alsotang',\n  age: 21\n});\ndefo.get('name').should.equal('Alsotang'); // => true\ndefo.get('age').should.equal(21); // => true\n```\n\n### #toObject\n\ntoObject would convert your Defo to a JavaScript Object.\n\nThis method will create a new object instead of modify Defo object.\n\n```js\nvar person = new Defo();\nperson\n  .set('name', 'Alsotang')\n  .set('age', 21);\n\nvar pet = new Defo();\npet\n  .set('name', 'Piglet')\n  .set('age', 3);\n\nvar house = new Defo();\nhouse\n  .set('person', person)\n  .set('pet', pet);\n\nconsole.log(house.toObject());\n// output:\n// { person: { name: 'Alsotang', age: 21 },\n//   pet: { name: 'Piglet', age: 3 } }\n```\n\n## Memoize\n\n```js\nvar fibonacci = new Defo(function (key) {\n  if (key === 1 || key === 2) {\n    this.set(key, 1);\n    return this.get(key);\n  }\n  this.set(key, this.get(key - 1) + this.get(key - 2));\n  return this.get(key);\n});\nfibonacci.get(15).should.equal(610); // 610 is 15-th of fibonacci sequence\nfibonacci.get(20).should.equal(6765);\nfibonacci._backed.should.eql({ '1': 1, '2': 1, '3': 2, '4': 3,\n  '5': 5, '6': 8, '7': 13, '8': 21, '9': 34, '10': 55,\n  '11': 89, '12': 144, '13': 233, '14': 377, '15': 610,\n  '16': 987, '17': 1597, '18': 2584, '19': 4181,\n  '20': 6765 });\n```\n\n## Why I create Defo\n\nIn my work, there are lots of situations to deal with data structure transformation.\n\nFor example, there is some rows from SQL database:\n\n```js\nvar ROWS = [\n// Name, Height, Weight, Country\n  [\"Alsotang\", 180, 60, \"Chinese\"],\n  [\"YB\", 165, 50, \"Chinese\"],\n  [\"Jack\", 179, 70, \"American\"],\n  [\"Lucy\", 170, 100, \"American\"]\n];\n```\n\nand I need to transform it to below:\n\n```js\nvar RESULTS = {\n  \"Chinese\": {\n    \"Alsotang\": {\n      \"Height\": 180,\n      \"Weight\": 60\n    },\n    \"YB\": {\n      \"Height\": 165,\n      \"Weight\": 50\n    }\n  },\n  \"American\": {\n    \"Jack\": {\n      \"Height\": 179,\n      \"Weight\": 70\n    },\n    \"Lucy\": {\n      \"Height\": 170,\n      \"Weight\": 100\n    }\n  }\n};\n```\n\nWith Defo, I can just write:\n\n```js\nvar result = new Defo( // in this Defo, key would be Chinese or American\n  new Defo( // would be Alsotang or Jack in this\n    new Defo() // Height or Weight\n    )\n  );\nROWS.forEach(function (person) {\n  var name = person[0],\n    height = person[1],\n    weight = person[2],\n    country = person[3];\n  result.get(country).get(name)\n  .set('Height', height)\n  .set('Weight', weight);\n});\nresult.toObject().should.eql(RESULTS); // => true\n```\n\nAnd it works! Otherwise the implement code is ugly, especially when the data structure is not such simple.\n\n## License\n\nMIT http://rem.mit-license.org","readmeFilename":"README.md","bugs":{"url":"https://github.com/alsotang/defo/issues"},"_id":"defo@2.1.3","dist":{"shasum":"9a5d45dd949a79ae1456a88fceaed4e8a37f7b4a","tarball":"https://registry.npmjs.org/defo/-/defo-2.1.3.tgz","integrity":"sha512-mafroBbtYZYysj93/AweKUPnuH5DXZlA0mvxwEd4HA3NwOk263MSqinQ0lPReDj/xG5qzrXDGYshowZJ+ybvtw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEVLRUt29Zup+C6vNIkjLj4D1ZbR0RR9v35ELQ3fcWiLAiACHAi3F2nt/LilomxvFAxvOA3BegcJNza8G0l7rkpimQ=="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"alsotang","email":"alsotang@gmail.com"},"maintainers":[{"name":"alsotang","email":"alsotang@gmail.com"}]}},"readme":"ERROR: No README data found!","maintainers":[{"name":"alsotang","email":"alsotang@gmail.com"}],"time":{"modified":"2022-06-14T23:31:57.624Z","created":"2013-09-07T11:10:06.986Z","0.0.1":"2013-09-07T11:10:10.737Z","0.1.0":"2013-09-07T14:39:21.718Z","0.1.1":"2013-09-07T14:43:45.985Z","0.1.2":"2013-09-07T14:55:58.805Z","0.1.3":"2013-09-07T15:10:21.851Z","0.2.3":"2013-09-07T16:01:22.904Z","0.2.4":"2013-09-07T16:07:41.459Z","0.2.5":"2013-09-07T16:14:20.722Z","0.2.6":"2013-09-07T16:15:29.202Z","1.0.0":"2013-09-07T16:23:38.773Z","1.0.1":"2013-09-07T16:36:28.765Z","1.0.2":"2013-09-07T16:44:29.396Z","1.1.0":"2013-09-07T17:30:31.452Z","2.1.0":"2013-09-10T08:41:23.531Z","2.1.1":"2013-09-10T08:55:09.501Z","2.1.2":"2013-09-10T09:04:47.997Z","2.1.3":"2013-09-10T13:00:40.462Z"},"author":{"name":"Alsotang","email":"alsotang@gmail.com"},"repository":{"type":"git","url":"https://github.com/alsotang/defo"}}