{"name":"muk-prop","description":"Mock object methods and properties.","keywords":["test","mock","stub"],"version":"1.0.1","repository":{"type":"git","url":"git://github.com/fent/muk-prop.js.git"},"author":{"name":"Roly Fentanes","url":"https://github.com/fent"},"main":"./lib/index.js","scripts":{"test":"istanbul cover node_modules/.bin/_mocha -- -R spec test/*-test.js"},"directories":{"lib":"./lib"},"devDependencies":{"mocha":"*","istanbul":"0"},"engines":{"node":">=0.12"},"license":"MIT","files":["lib"],"gitHead":"0e4053a79934ac8ab7cc116b11a95007f6b040dc","bugs":{"url":"https://github.com/fent/muk-prop.js/issues"},"homepage":"https://github.com/fent/muk-prop.js#readme","_id":"muk-prop@1.0.1","_npmVersion":"5.3.0","_nodeVersion":"8.3.0","_npmUser":{"name":"fent","email":"roly426@gmail.com"},"dist":{"integrity":"sha512-E+awtpiN/XqnUhBzjjFdBb8BbYDmmNV7xEl/PJSTbil6bvLkiOzC2v15om7i4qoypfSSpkowdU5nRTK38YS5og==","shasum":"38a087b782ed2687b2df5592a4155040f64d0887","tarball":"http://registry-npm.ywwl.com/muk-prop/download/muk-prop-1.0.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICBXvmLZEDVfBOLzfCu4Vo/zqllP4cBazFfiICz1UTvYAiEA7OcIPK+qKXF75j2tiG6LwuaZaEQzuVb0P+/iJG4LIZU="}],"size":2487,"noattachment":false,"key":"/muk-prop/-/muk-prop-1.0.1.tgz"},"maintainers":[{"name":"fent","email":"roly426@gmail.com"},{"name":"popomore","email":"sakura9515@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/muk-prop-1.0.1.tgz_1502341689788_0.28167852107435465"},"readme":"# muk-prop.js\n\n[![Build Status](https://secure.travis-ci.org/fent/muk-prop.js.svg)](http://travis-ci.org/fent/muk-prop.js)\n[![Dependency Status](https://david-dm.org/fent/muk-prop.js.svg)](https://david-dm.org/fent/muk-prop.js)\n[![codecov](https://codecov.io/gh/fent/muk-prop.js/branch/master/graph/badge.svg)](https://codecov.io/gh/fent/muk-prop.js)\n\n![muk](muk.gif)\n\n# Usage\n\nObject method mocking.\n\n```js\nconst fs = require('fs');\nconst muk = require('muk-prop');\n\nmuk(fs, 'readFile', (path, callback) => {\n  process.nextTick(callback.bind(null, null, 'file contents here'));\n});\n```\n\nObject props mocking with setter/getter.\n\n```js\nconst muk = require('muk-prop');\n\nconst obj = { _a: 1 };\nmuk(obj, 'a', {\n  set: (val) => obj._a = val * 2,\n  get: (val) => obj._a,\n});\n\nobj.a = 2;\nconsole.log(obj.a); // 4\n```\n\nCheck if member has been mocked.\n\n```js\nmuk.isMocked(fs, 'readFile'); // true\n```\n\nRestore all mocked methods/props after tests.\n\n```js\nmuk.restore();\n\nfs.readFile(file, (err, data) => {\n  // will actually read from `file`\n});\n```\n\n\n# Install\n\n    npm install muk-prop\n\n\n# Tests\nTests are written with [mocha](https://mochajs.org)\n\n```bash\nnpm test\n```\n","publish_time":1502341690846,"_cnpm_publish_time":1502341690846,"dist-tags":{"latest":"3.0.2"}}