{"name":"muk-prop","description":"Mock object methods and properties.","keywords":["test","mock","stub"],"version":"1.1.0","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":{"istanbul":"^0.4.5","mocha":"^4.0.1"},"engines":{"node":">=4"},"license":"MIT","files":["lib"],"gitHead":"f19ce542650232ce23518b21680c5993ac2fb1eb","bugs":{"url":"https://github.com/fent/muk-prop.js/issues"},"homepage":"https://github.com/fent/muk-prop.js#readme","_id":"muk-prop@1.1.0","_npmVersion":"5.4.2","_nodeVersion":"8.8.1","_npmUser":{"name":"fent","email":"roly426@gmail.com"},"dist":{"integrity":"sha512-zul86QuY6Wi4KQ6bx8ZB8GYxEWh1X8Q6PJb9awXJ6gpismxJbtbuDqgJKFxfurFSow7xonG1mvm3Umn2uX1Row==","shasum":"583137602c10890a558356a8bfe6de62435d63b4","tarball":"http://registry-npm.ywwl.com/muk-prop/download/muk-prop-1.1.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDATP/BYnAIttB2o2SP/wE03w/Lr8L+bSw9hWvJao9wGwIgfnZquMWd7Z+HVdnvNsRVmlhw27RKlFyjn/wmRqAaoVQ="}],"size":2376,"noattachment":false,"key":"/muk-prop/-/muk-prop-1.1.0.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.1.0.tgz_1509296975669_0.4011617961805314"},"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":1509296976638,"_cnpm_publish_time":1509296976638,"dist-tags":{"latest":"3.0.2"}}