{"_id":"muk-prop@3.0.2","bugs":{"url":"https://github.com/fent/muk-prop.js/issues"},"dist":{"shasum":"9cfff7ed73717d695a75bba3068225743fde0d37","tarball":"http://registry-npm.ywwl.com/muk-prop/download/muk-prop-3.0.2.tgz","fileCount":6,"integrity":"sha512-zHSP662iGwTj2S+/FTopLKZvq8AtbywevY8YTGnEyetJ8Q+cRAOysy7a77kleFWV0FQ6W4KPy9MywdcMJW5kxw==","signatures":[{"sig":"MEQCIFwWm8ieGUtxRR1YTWbbsx8J+lSyRTfdTb0TZWkP8J2vAiBU3VkB2l0wh7RzTmxSXH7jzOsgcxUhh9ZlydOtQU70XA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIE+/uDTbdaZJAaHbjFQ7e76Iw0C7AVL2f5/zT2jnXom0AiEAv8fzy2wenFAF4CSx2J73USI0fg+J5g2kxAXhGX2V3ds="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/muk-prop@3.0.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":8498,"size":3559,"noattachment":false,"key":"/muk-prop/-/muk-prop-3.0.2.tgz"},"main":"./dist/index.js","name":"muk-prop","types":"./dist/index.d.ts","author":{"url":"https://github.com/fent","name":"fent","email":"fentbox@gmail.com"},"engines":{"node":">=6"},"gitHead":"90868abfdd5b44b2b73edba8d212890ba6007d71","license":"MIT","scripts":{"lint":"eslint ./src ./test","test":"nyc --extension .ts --reporter=lcov --reporter=text-summary npm run test:unit","build":"tsc -p tsconfig.build.json","format":"prettier --write .","prepare":"tsc -p tsconfig.build.json","lint:fix":"eslint --fix ./src ./test","test:unit":"mocha --require ts-node/register test/*-test.ts","format:check":"prettier --check ."},"version":"3.0.2","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"e9d647c9-4493-4705-a370-10820413bae9"}},"homepage":"https://github.com/fent/muk-prop.js#readme","keywords":["test","mock","stub"],"repository":{"url":"git://github.com/fent/muk-prop.js.git","type":"git"},"_npmVersion":"11.21.2","description":"Mock object methods and properties.","directories":{},"maintainers":[{"name":"fent","email":"fentbox@gmail.com"},{"name":"popomore","email":"sakura9515@gmail.com"}],"sideEffects":false,"_nodeVersion":"26.13.0","_hasShrinkwrap":false,"devDependencies":{"nyc":"^18.0.0","mocha":"^12.0.3","eslint":"^8.57.1","ts-node":"^10.9.2","prettier":"^3.9.10","typescript":"^5.6.3","@types/node":"^22.9.0","@types/mocha":"^10.0.10","eslint-config-prettier":"^10.1.8","@typescript-eslint/parser":"^8.72.0","@typescript-eslint/eslint-plugin":"^8.72.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/muk-prop_3.0.2_1794079298398_0.08521741428272267"},"readme":"# muk-prop.js\n\n[![npm](https://img.shields.io/npm/v/muk-prop)](https://www.npmjs.com/package/muk-prop)\n[![Node.js CI](https://github.com/fent/muk-prop.js/actions/workflows/nodejs.yml/badge.svg)](https://github.com/fent/muk-prop.js/actions/workflows/nodejs.yml)\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 property mocking with getter/setter.\n\n```js\nconst muk = require('muk-prop');\n\nconst obj = { _a: 1 };\nmuk(obj, 'a', {\n  get: (val) => obj._a,\n  set: (val) => (obj._a = val * 2),\n});\n\nobj.a = 2;\nconsole.log(obj.a); // 4\n```\n\nCheck if property 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# Install\n\n    npm install muk-prop\n\n# Tests\n\nTests are written with [mocha](https://mochajs.org)\n\n```bash\nnpm test\n```\n","publish_time":1794079298519,"_cnpm_publish_time":1794079298519,"dist-tags":{"latest":"3.0.2"}}