{"id":17472691,"url":"https://github.com/shinnn/script-equal","last_synced_at":"2025-03-28T08:10:06.175Z","repository":{"id":23580118,"uuid":"26948317","full_name":"shinnn/script-equal","owner":"shinnn","description":"Check if one JavaScript code is equivalent to another code","archived":false,"fork":false,"pushed_at":"2014-11-21T09:59:27.000Z","size":136,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-02T08:42:11.607Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shinnn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-21T06:24:22.000Z","updated_at":"2014-11-21T09:58:59.000Z","dependencies_parsed_at":"2022-07-16T17:30:34.402Z","dependency_job_id":null,"html_url":"https://github.com/shinnn/script-equal","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fscript-equal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fscript-equal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fscript-equal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fscript-equal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shinnn","download_url":"https://codeload.github.com/shinnn/script-equal/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245991582,"owners_count":20706129,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-18T17:33:56.050Z","updated_at":"2025-03-28T08:10:06.154Z","avatar_url":"https://github.com/shinnn.png","language":"JavaScript","readme":"# script-equal \n\n[![Build Status](https://travis-ci.org/shinnn/script-equal.svg?branch=master)](https://travis-ci.org/shinnn/script-equal)\n[![Build status](https://ci.appveyor.com/api/projects/status/6y21wd4dva7cu4rw?svg=true)](https://ci.appveyor.com/project/ShinnosukeWatanabe/script-equal)\n[![Coverage Status](https://img.shields.io/coveralls/shinnn/script-equal.svg)](https://coveralls.io/r/shinnn/script-equal)\n[![Dependency Status](https://david-dm.org/shinnn/script-equal.svg)](https://david-dm.org/shinnn/script-equal)\n[![devDependency Status](https://david-dm.org/shinnn/script-equal/dev-status.svg)](https://david-dm.org/shinnn/script-equal#info=devDependencies)\n\nCheck if one JavaScript code is equivalent to another code, using [UglifyJS]\n\n```javascript\nvar scriptEqual = require('script-equal');\n\nscriptEqual(\n  'window.foo = {a: 0, b: 1};',\n  'window[\"foo\"]={\\nb: 1,\\rna: 0\\n};'\n); //=\u003e true\n\nscriptEqual(\n  'var foo = 12',\n  'var foo = 1 + 1 * 14 - 3;;;;;;;;;;;;;;;;;;;'\n); //=\u003e true\n```\n\n## Installation\n\n[![NPM version](https://badge.fury.io/js/script-equal.svg)](https://www.npmjs.org/package/script-equal)\n\n[Use npm.](https://www.npmjs.org/doc/cli/npm-install.html)\n\n```\nnpm install script-equal\n```\n\n## API\n\n```javascript\nvar scriptEqual = require('script-equal');\n```\n\n### scriptEqual(*script0*, *script1* [, *options*])\n\n*script0*:`String` (JavaScript code)  \n*script1*:`String` (JavaScript code)  \n*options*: `Object` ([UglifyJS][options] options)  \nReturn: `Boolean`\n\nIt compresses two JavaScript string with [UglifyJS]. If the results are the same string, it returns `true`. Otherwise it returns `false`.\n\nYou can use all [UglifyJS][options] options.\n\n```javascript\nvar scriptEqual = require('script-equal');\n\nvar foo = 'a = {}; a.b = 0;';\nvar bar = 'a = {}; a[\\'b\\'] = 0;';\n\nscriptEqual(foo, bar); //=\u003e true\n\nscriptEqual(foo, bar, {\n  compress: {properties: false}\n}); //=\u003e false\n```\n\nIt throws an error when it fails to parse strings.\n\n```javascript\nscriptEqual('a = 1', '1 = a'); // Error\n```\n\n## License\n\nCopyright (c) 2014 [Shinnosuke Watanabe](https://github.com/shinnn)\n\nLicensed under [the MIT License](./LICENSE).\n\n[UglifyJS]: https://github.com/mishoo/UglifyJS2\n[options]: https://github.com/mishoo/UglifyJS2#api-reference\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinnn%2Fscript-equal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshinnn%2Fscript-equal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinnn%2Fscript-equal/lists"}