{"_id":"clean-match","_rev":"4175174","name":"clean-match","description":"A simple, fast, zero-dependency, ES2015+ aware deep matching utility","dist-tags":{"latest":"1.0.2"},"maintainers":[{"name":"isiahmeadows","email":""}],"time":{"modified":"2026-03-01T21:29:36.000Z","created":"2017-01-09T07:12:33.141Z","1.0.2":"2017-01-09T07:48:51.053Z","1.0.1":"2017-01-09T07:42:35.659Z","1.0.0":"2017-01-09T07:12:33.141Z"},"users":{},"author":{"name":"Isiah Meadows"},"repository":{"type":"git","url":"git+https://github.com/isiahmeadows/clean-match.git"},"versions":{"1.0.2":{"name":"clean-match","version":"1.0.2","description":"A simple, fast, zero-dependency, ES2015+ aware deep matching utility","scripts":{"lint":"eslint .","test":"eslint . && npm run test:node","test:all":"eslint . && npm run test:node && npm run test:chrome && npm run test:firefox && npm run test:phantomjs","test:node":"mocha --colors","test:chrome":"karma start --colors --single-run --browsers Chrome","test:firefox":"karma start --colors --single-run --browsers Firefox","test:phantomjs":"karma start --colors --single-run --browsers PhantomJS","minify":"uglifyjs clean-match.js --compress --mangle --comments > clean-match.min.js","preversion":"npm run minify"},"main":"clean-match.js","files":["clean-match.js","clean-match.min.js","index.d.ts"],"author":{"name":"Isiah Meadows"},"license":"ISC","devDependencies":{"benchmark":"^2.1.1","eslint":"^3.13.0","eslint-config-isiahmeadows":"^0.1.8","karma":"^1.1.0","karma-chrome-launcher":"^2.0.0","karma-firefox-launcher":"^1.0.0","karma-mocha":"^1.1.1","karma-phantomjs-launcher":"^1.0.2","mocha":"^3.2.0","uglify-js":"^2.7.5"},"repository":{"type":"git","url":"git+https://github.com/isiahmeadows/clean-match.git"},"bugs":{"url":"https://github.com/isiahmeadows/clean-match/issues"},"homepage":"https://github.com/isiahmeadows/clean-match#readme","gitHead":"a6a0d57fda6da267501420d86174a7628d2efe1d","_id":"clean-match@1.0.2","_shasum":"141ecd9b9dde0db100f3bff8322d127199da9443","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"isiahmeadows","email":"me@isiahmeadows.com"},"dist":{"shasum":"141ecd9b9dde0db100f3bff8322d127199da9443","size":10498,"noattachment":false,"key":"/clean-match/-/clean-match-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/clean-match/download/clean-match-1.0.2.tgz"},"maintainers":[{"name":"isiahmeadows","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/clean-match-1.0.2.tgz_1483948129045_0.0030794627964496613"},"directories":{},"publish_time":1483948131053,"_hasShrinkwrap":false,"deprecated":"Internalized to Clean Assert: https://github.com/isiahmeadows/clean-assert","_cnpm_publish_time":1483948131053,"_cnpmcore_publish_time":"2021-12-17T03:41:16.501Z"},"1.0.1":{"name":"clean-match","version":"1.0.1","description":"A simple, fast, zero-dependency, ES2015+ aware deep matching utility","scripts":{"lint":"eslint .","test":"eslint . && npm run test:node","test:all":"eslint . && npm run test:node && npm run test:chrome && npm run test:firefox && npm run test:phantomjs","test:node":"mocha --colors","test:chrome":"karma start --colors --single-run --browsers Chrome","test:firefox":"karma start --colors --single-run --browsers Firefox","test:phantomjs":"karma start --colors --single-run --browsers PhantomJS","minify":"uglifyjs clean-match.js --compress --mangle --comments > clean-match.min.js","preversion":"npm run minify"},"files":["clean-match.js","clean-match.min.js","index.d.ts"],"author":{"name":"Isiah Meadows"},"license":"ISC","devDependencies":{"benchmark":"^2.1.1","eslint":"^3.13.0","eslint-config-isiahmeadows":"^0.1.8","karma":"^1.1.0","karma-chrome-launcher":"^2.0.0","karma-firefox-launcher":"^1.0.0","karma-mocha":"^1.1.1","karma-phantomjs-launcher":"^1.0.2","mocha":"^3.2.0","uglify-js":"^2.7.5"},"repository":{"type":"git","url":"git+https://github.com/isiahmeadows/clean-match.git"},"bugs":{"url":"https://github.com/isiahmeadows/clean-match/issues"},"homepage":"https://github.com/isiahmeadows/clean-match#readme","gitHead":"8dbe29bd4a70c0ae94f1a185bb595ee74a7cc1e0","_id":"clean-match@1.0.1","_shasum":"72ad878cb5a5b099853d40178bf62dabb9aae813","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"isiahmeadows","email":"me@isiahmeadows.com"},"dist":{"shasum":"72ad878cb5a5b099853d40178bf62dabb9aae813","size":10488,"noattachment":false,"key":"/clean-match/-/clean-match-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/clean-match/download/clean-match-1.0.1.tgz"},"maintainers":[{"name":"isiahmeadows","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/clean-match-1.0.1.tgz_1483947753688_0.2396092377603054"},"directories":{},"publish_time":1483947755659,"_hasShrinkwrap":false,"deprecated":"Internalized to Clean Assert: https://github.com/isiahmeadows/clean-assert","_cnpm_publish_time":1483947755659,"_cnpmcore_publish_time":"2021-12-17T03:41:16.907Z"},"1.0.0":{"name":"clean-match","version":"1.0.0","description":"A simple, fast, zero-dependency, ES2015+ aware deep matching utility","scripts":{"lint":"eslint .","test":"eslint . && npm run test:node","test:all":"eslint . && npm run test:node && npm run test:chrome && npm run test:firefox && npm run test:phantomjs","test:node":"mocha --colors","test:chrome":"karma start --colors --single-run --browsers Chrome","test:firefox":"karma start --colors --single-run --browsers Firefox","test:phantomjs":"karma start --colors --single-run --browsers PhantomJS","minify":"uglifyjs clean-match.js --compress --mangle --comments > clean-match.min.js","preversion":"npm run minify"},"author":{"name":"Isiah Meadows"},"license":"ISC","devDependencies":{"benchmark":"^2.1.1","eslint":"^3.13.0","eslint-config-isiahmeadows":"^0.1.8","karma":"^1.1.0","karma-chrome-launcher":"^2.0.0","karma-firefox-launcher":"^1.0.0","karma-mocha":"^1.1.1","karma-phantomjs-launcher":"^1.0.2","mocha":"^3.2.0","uglify-js":"^2.7.5"},"repository":{"type":"git","url":"git+https://github.com/isiahmeadows/clean-match.git"},"bugs":{"url":"https://github.com/isiahmeadows/clean-match/issues"},"homepage":"https://github.com/isiahmeadows/clean-match#readme","gitHead":"133af06f7a3e2c53aac0832402f55338e6b59d6c","_id":"clean-match@1.0.0","_shasum":"2be16dff12c7be03a36f71efe54faba2dc599b97","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"isiahmeadows","email":"me@isiahmeadows.com"},"dist":{"shasum":"2be16dff12c7be03a36f71efe54faba2dc599b97","size":15015,"noattachment":false,"key":"/clean-match/-/clean-match-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/clean-match/download/clean-match-1.0.0.tgz"},"maintainers":[{"name":"isiahmeadows","email":""}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/clean-match-1.0.0.tgz_1483945952621_0.2785583441145718"},"directories":{},"publish_time":1483945953141,"_hasShrinkwrap":false,"deprecated":"Internalized to Clean Assert: https://github.com/isiahmeadows/clean-assert","_cnpm_publish_time":1483945953141,"_cnpmcore_publish_time":"2021-12-17T03:41:17.137Z"}},"readme":"[![Build Status](https://travis-ci.org/isiahmeadows/clean-match.svg?branch=master)](https://travis-ci.org/isiahmeadows/clean-match)\n\n# clean-match\n\nA simple, fast, zero-dependency, ES2015+ aware deep matching utility, with support for ES5 environments. Tested in Node 4+ and PhantomJS 2.\n\n## Installation\n\nInstall via [npm](https://www.npmjs.com/package/clean-match):\n\n```\nnpm install --save clean-match\n```\n\nAnd some basic usage in Node or Browserify:\n\n```js\nvar match = require(\"clean-match\")\nvar foo = {a: 1, b: 2}\n\nif (match.loose(foo, {a: 1, b: 2})) {\n    console.log(\"It matched!\")\n}\n```\n\nYou may also use it in the browser:\n\n```html\n<script src=\"./node_modules/clean-match/clean-match.js\"></script>\n<script>\nvar foo = {a: 1, b: 2}\n\nif (match.loose(foo, {a: 1, b: 2})) {\n    alert(\"It matched!\")\n}\n</script>\n```\n\nIt's also usable as an AMD module:\n\n```js\ndefine([\"clean-match\"], function (match) {\n    var foo = {a: 1, b: 2}\n\n    if (match.loose(foo, {a: 1, b: 2})) {\n        console.log(\"It matched!\")\n    }    \n})\n```\n\n## API\n\n```js\nmatch.loose(a, b)\n```\n\nCompare two values, either primitives or objects, structurally without regard to their prototypes. Note that this does still do some type checking:\n\n- Primitives and their wrapper objects do not match\n- Symbols are checked for their description, not for identity\n- Dates are matched through their values\n- Arrays don't match plain objects or `arguments`\n- Typed arrays don't match anything other than another array of the same type\n- Objects, maps, and sets have their contents compared in an order-independent fashion\n- It checks typed arrays, Buffers, ArrayBuffers and DataViews\n- Expando properties aren't checked on arrays/maps/sets/etc.\n- It works with the core-js Symbol polyfill if it's the global, and they are checked just like the native primitives\n- It ignores the `stack` property on Errors\n- Objects that are specially handled (e.g. Dates, arrays, `arguments`, Errors) are checked to have the same prototype.\n\nHere's a couple other notes:\n\n- This is somewhat defensive against buggy legacy engines. (e.g. Safari, PhantomJS)\n- This accepts Browserify's `Buffer` polyfill in Node.\n- This intentionally avoids Browserify's global detection beyond just `global`.\n\n```js\nmatch.strict(a, b)\n```\n\nCompare two values, either primitives or objects, structurally, but also verify that their prototypes match (and their children, recursively). The above notes for `match.loose` also apply, except that symbols are checked for identity instead.\n\n## Why another deep equality algorithm?\n\nThere's many reasons:\n\n1. It's not that uncommon just to want to assert that two values match without checking their types.\n2. Most deep equality algorithms are slow, with Node's native `assert` and Lodash's `_.match` being the primary exceptions.\n3. Most deep equality algorithms aren't ES6-aware, especially when maps and sets get into the picture.\n4. Error stacks are practically useless when matching them. In addition, PhantomJS and IE both generate the stack *when the error is thrown*, not when it was created.\n5. It's often helpful to match symbols, dates, and other value-like types for their value, not their identity.\n\n## License\n\nCopyright (c) 2016 and later, Isiah Meadows <me@isiahmeadows.com>.\n\nPermission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n","_attachments":{},"homepage":"https://github.com/isiahmeadows/clean-match#readme","bugs":{"url":"https://github.com/isiahmeadows/clean-match/issues"},"license":"ISC"}