{"name":"muk-prop","description":"Mock object methods and properties.","keywords":["test","mock","stub"],"version":"2.0.0","repository":{"type":"git","url":"git://github.com/fent/muk-prop.js.git"},"author":{"name":"fent","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":"^5.0.0"},"engines":{"node":">=4"},"license":"MIT","files":["lib"],"gitHead":"267189bcafb25e847def9699d4724fef5a688843","bugs":{"url":"https://github.com/fent/muk-prop.js/issues"},"homepage":"https://github.com/fent/muk-prop.js#readme","_id":"muk-prop@2.0.0","_npmVersion":"5.5.1","_nodeVersion":"8.9.3","_npmUser":{"name":"popomore","email":"sakura9515@gmail.com"},"dist":{"integrity":"sha512-tIxpVLQBIwE0Rw1CH2AQ3fLulITQUGJQ60Ji496ZvTRX7EbhuR8DaXvaHASWfL0jUpBuZ/XjhhbyULJ0e4feZA==","shasum":"0384a4c7961e69572bd6521858d0f4418f8bb07a","tarball":"http://registry-npm.ywwl.com/muk-prop/download/muk-prop-2.0.0.tgz","fileCount":5,"unpackedSize":4845,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGpot8ajz8z1I9yRfFD7Izoah8zkg3kwETB/L0YU7p0vAiEAwSUGoQGXiZQTT7MMhJr96lWP5TJejIjwmo+elk6UuWw="}],"size":2511,"noattachment":false,"key":"/muk-prop/-/muk-prop-2.0.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_2.0.0_1522044220596_0.3585148150069688"},"_hasShrinkwrap":false,"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":1522044222244,"_cnpm_publish_time":1522044222244,"dist-tags":{"latest":"3.0.2"}}