script-equal
Check if one JavaScript code is equivalent to another code, using UglifyJS
var scriptEqual = ; ; //=> true ; //=> true
Installation
npm install script-equal
API
var scriptEqual = ;
scriptEqual(script0, script1 [, options])
script0:String
(JavaScript code)
script1:String
(JavaScript code)
options: Object
(UglifyJS options)
Return: Boolean
It compresses two JavaScript string with UglifyJS. If the results are the same string, it returns true
. Otherwise it returns false
.
You can use all UglifyJS options.
var scriptEqual = ; var foo = 'a = {}; a.b = 0;';var bar = 'a = {}; a[\'b\'] = 0;'; ; //=> true ; //=> false
It throws an error when it fails to parse strings.
; // Error
License
Copyright (c) 2014 Shinnosuke Watanabe
Licensed under the MIT License.