{"_id":"@cnpmjs/muk-prop","_rev":"1572340","name":"@cnpmjs/muk-prop","description":"Mock object methods and properties.","dist-tags":{"latest":"1.1.1"},"maintainers":[{"name":"gemwuu","email":"gemwuu@gmail.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"killagu","email":"killa07071201@gmail.com"},{"name":"atian25","email":"atian25@qq.com"}],"time":{"modified":"2026-10-16T01:46:17.000Z","created":"2024-12-20T12:34:09.852Z","1.1.1":"2024-12-22T03:54:52.024Z","1.1.0":"2024-12-21T15:31:47.799Z","1.0.0":"2024-12-20T12:34:09.852Z"},"users":{},"repository":{"url":"git://github.com/node-modules/muk-prop.js.git","type":"git"},"versions":{"1.1.1":{"name":"@cnpmjs/muk-prop","version":"1.1.1","keywords":["test","mock","stub"],"license":"MIT","_id":"@cnpmjs/muk-prop@1.1.1","maintainers":[{"name":"gemwuu","email":"gemwuu@gmail.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"killagu","email":"killa07071201@gmail.com"},{"name":"atian25","email":"atian25@qq.com"}],"homepage":"https://github.com/node-modules/muk-prop.js#readme","bugs":{"url":"https://github.com/node-modules/muk-prop.js/issues"},"dist":{"shasum":"93a48d15ff3ba6dc7c95e7fc2628864f514dacbc","tarball":"http://registry-npm.ywwl.com/@cnpmjs/muk-prop/download/@cnpmjs/muk-prop-1.1.1.tgz","fileCount":11,"integrity":"sha512-ZZqkz6pZKQZbO1JusG/HUZ7xNRtf86XevYNG+O3vUVNOlsxrNT0O9A1eVcJbN36PFxjhKUY+WMmoYtKJhHrpVA==","signatures":[{"sig":"MEYCIQDNAa6GONBNo/pjhE11w5XR14zLk5ON20PC7twcqSLpeQIhAKRyP5RuNbT1w3f+UXS+tS3wgqEnsTw+AcwB3Ip9gxnF","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@cnpmjs%2fmuk-prop@1.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":17791,"size":5205,"noattachment":false,"key":"/@cnpmjs/muk-prop/-/@cnpmjs/muk-prop-1.1.1.tgz"},"main":"./dist/commonjs/index.js","tshy":{"exports":{".":"./src/index.ts","./package.json":"./package.json"}},"type":"module","types":"./dist/commonjs/index.d.ts","module":"./dist/esm/index.js","engines":{"node":">= 18.19.0"},"exports":{".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}},"./package.json":"./package.json"},"gitHead":"ed36f2655af4d18da1af69042bc7f7278e2dba5c","scripts":{"ci":"egg-bin cov","lint":"eslint --cache src test --ext .ts","test":"egg-bin test","preci":"npm run lint && npm run prepublishOnly && attw --pack","pretest":"npm run lint -- --fix && npm run prepublishOnly","prepublishOnly":"tshy && tshy-after"},"_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"repository":{"url":"git://github.com/node-modules/muk-prop.js.git","type":"git"},"_npmVersion":"10.8.2","description":"Mock object methods and properties.","directories":{},"_nodeVersion":"18.20.5","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tshy":"3","eslint":"8","egg-bin":"6","tshy-after":"1","typescript":"5","@types/node":"22","@types/mocha":"10","@eggjs/tsconfig":"1","eslint-config-egg":"14","@arethetypeswrong/cli":"^0.17.1"},"_npmOperationalInternal":{"tmp":"tmp/muk-prop_1.1.1_1734839691868_0.13738043414554402","host":"s3://npm-registry-packages-npm-production"},"publish_time":1734839692024,"_cnpm_publish_time":1734839692024},"1.1.0":{"name":"@cnpmjs/muk-prop","version":"1.1.0","keywords":["test","mock","stub"],"license":"MIT","_id":"@cnpmjs/muk-prop@1.1.0","maintainers":[{"name":"gemwuu","email":"gemwuu@gmail.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"killagu","email":"killa07071201@gmail.com"},{"name":"atian25","email":"atian25@qq.com"}],"homepage":"https://github.com/node-modules/muk-prop.js#readme","bugs":{"url":"https://github.com/node-modules/muk-prop.js/issues"},"dist":{"shasum":"f05e437621e2d01560939c7962025e0e0106552f","tarball":"http://registry-npm.ywwl.com/@cnpmjs/muk-prop/download/@cnpmjs/muk-prop-1.1.0.tgz","fileCount":11,"integrity":"sha512-ZwIEv9qYKnxWyrT5Aez3/yE+qavgi019PXhBAi+5yxufOGuFiX5ZNGeaWg6E6XQsP8wn/ua3g23d7LzVADH5ww==","signatures":[{"sig":"MEYCIQCXF//tEApYguXuJ1HR7O6m2fG5Msn4DfCS8n2K0OGJ0QIhAL1KDUM+AHW+aH+3CHbJ6OXqh7j1HUac3uD6qzwmytSa","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@cnpmjs%2fmuk-prop@1.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":16228,"size":4973,"noattachment":false,"key":"/@cnpmjs/muk-prop/-/@cnpmjs/muk-prop-1.1.0.tgz"},"main":"./dist/commonjs/index.js","tshy":{"exports":{".":"./src/index.ts","./package.json":"./package.json"}},"type":"module","types":"./dist/commonjs/index.d.ts","module":"./dist/esm/index.js","engines":{"node":">= 18.19.0"},"exports":{".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}},"./package.json":"./package.json"},"gitHead":"1e2b166094aa41ca875a574e93b5b20217b52486","scripts":{"ci":"egg-bin cov","lint":"eslint --cache src test --ext .ts","test":"egg-bin test","preci":"npm run lint && npm run prepublishOnly && attw --pack","pretest":"npm run lint -- --fix && npm run prepublishOnly","prepublishOnly":"tshy && tshy-after"},"_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"repository":{"url":"git://github.com/node-modules/muk-prop.js.git","type":"git"},"_npmVersion":"10.8.2","description":"Mock object methods and properties.","directories":{},"_nodeVersion":"18.20.5","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tshy":"3","eslint":"8","egg-bin":"6","tshy-after":"1","typescript":"5","@types/node":"22","@types/mocha":"10","@eggjs/tsconfig":"1","eslint-config-egg":"14","@arethetypeswrong/cli":"^0.17.1"},"_npmOperationalInternal":{"tmp":"tmp/muk-prop_1.1.0_1734795107545_0.6473445987906228","host":"s3://npm-registry-packages-npm-production"},"publish_time":1734795107799,"_cnpm_publish_time":1734795107799},"1.0.0":{"name":"@cnpmjs/muk-prop","version":"1.0.0","keywords":["test","mock","stub"],"license":"MIT","_id":"@cnpmjs/muk-prop@1.0.0","maintainers":[{"name":"gemwuu","email":"gemwuu@gmail.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"killagu","email":"killa07071201@gmail.com"},{"name":"atian25","email":"atian25@qq.com"}],"homepage":"https://github.com/node-modules/muk-prop.js#readme","bugs":{"url":"https://github.com/node-modules/muk-prop.js/issues"},"dist":{"shasum":"11452c4f1a946248b60df4d3fb93cfa53f565e72","tarball":"http://registry-npm.ywwl.com/@cnpmjs/muk-prop/download/@cnpmjs/muk-prop-1.0.0.tgz","fileCount":11,"integrity":"sha512-yMUKcXrcY/ekIyfw04dMoRB3SBj3rmteGBRbJSCKS9B3OpqhTtDuW3HUtt+JlQ1hqWt7WjzqdgFSsCresRmYJw==","signatures":[{"sig":"MEUCIHyhahIOawMm74V1geybhlMCSlNojGVqnkBcdMqKklLiAiEAxhSwiAcDIzJ9QFrzYXTkXM8oQdUp/SRj13tDHze4AgM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@cnpmjs%2fmuk-prop@1.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":16175,"size":4989,"noattachment":false,"key":"/@cnpmjs/muk-prop/-/@cnpmjs/muk-prop-1.0.0.tgz"},"main":"./dist/commonjs/index.js","tshy":{"exports":{".":"./src/index.ts","./package.json":"./package.json"}},"type":"module","types":"./dist/commonjs/index.d.ts","module":"./dist/esm/index.js","engines":{"node":">= 18.19.0"},"exports":{".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}},"./package.json":"./package.json"},"gitHead":"42046e359556c4c4d169be8b5b3be44d2e4de73e","scripts":{"ci":"egg-bin cov","lint":"eslint --cache src test --ext .ts","test":"egg-bin test","preci":"npm run lint && npm run prepublishOnly && attw --pack","pretest":"npm run lint -- --fix && npm run prepublishOnly","prepublishOnly":"tshy && tshy-after"},"_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"repository":{"url":"git://github.com/node-modules/muk-prop.js.git","type":"git"},"_npmVersion":"10.8.2","description":"Mock object methods and properties.","directories":{},"_nodeVersion":"18.20.5","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tshy":"3","eslint":"8","egg-bin":"6","tshy-after":"1","typescript":"5","@types/node":"22","@types/mocha":"10","@eggjs/tsconfig":"1","eslint-config-egg":"14","@arethetypeswrong/cli":"^0.17.1"},"_npmOperationalInternal":{"tmp":"tmp/muk-prop_1.0.0_1734698049674_0.8882424981432904","host":"s3://npm-registry-packages-npm-production"},"publish_time":1734698049852,"_cnpm_publish_time":1734698049852}},"readme":"# @cnpmjs/muk-prop\n\n[![NPM version][npm-image]][npm-url]\n[![Node.js CI](https://github.com/node-modules/muk-prop.js/actions/workflows/nodejs.yml/badge.svg)](https://github.com/node-modules/muk-prop.js/actions/workflows/nodejs.yml)\n[![codecov](https://codecov.io/gh/node-modules/muk-prop.js/graph/badge.svg?token=YuWQxJfyk2)](https://codecov.io/gh/node-modules/muk-prop.js)\n[![npm download][download-image]][download-url]\n[![Node.js Version](https://img.shields.io/node/v/@cnpmjs/muk-prop.svg?style=flat)](https://nodejs.org/en/download/)\n\n[npm-image]: https://img.shields.io/npm/v/@cnpmjs/muk-prop.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/@cnpmjs/muk-prop\n[download-image]: https://img.shields.io/npm/dm/@cnpmjs/muk-prop.svg?style=flat-square\n[download-url]: https://npmjs.org/package/@cnpmjs/muk-prop\n\n![muk](muk.gif)\n\n## Usage\n\nObject method mocking.\n\n```js\nconst fs = require('fs');\nconst { muk } = require('@cnpmjs/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('@cnpmjs/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\nconst { isMocked } = require('@cnpmjs/muk-prop');\n\nisMocked(fs, 'readFile'); // true\n```\n\nRestore all mocked methods/props after tests.\n\n```js\nconst { restore } = require('@cnpmjs/muk-prop');\n\nfs.readFile(file, (err, data) => {\n  // will actually read from `file`\n});\n```\n\n## Install\n\n```bash\nnpm install @cnpmjs/muk-prop\n```\n\n## Tests\n\nTests are written with [mocha](https://mochajs.org)\n\n```bash\nnpm test\n```\n\n## Contributors\n\n[![Contributors](https://contrib.rocks/image?repo=node-modules/muk-prop.js)](https://github.com/node-modules/muk-prop.js/graphs/contributors)\n\nMade with [contributors-img](https://contrib.rocks).\n","_attachments":{},"homepage":"https://github.com/node-modules/muk-prop.js#readme","bugs":{"url":"https://github.com/node-modules/muk-prop.js/issues"},"license":"MIT"}