Greg Hinch![]()
Allows you to perform equality comparison of two objects, arrays, or functions, as well as all other basic javascript types.
Simply pass Y.Compare any 2 values and it will test their equality and return a boolean
<script src="http://yui.yahooapis.com/3.3.0/build/yui/yui-min.js"></script>YUI({
//Last Gallery Build of this module
gallery: 'gallery-2011.02.16-20-31'
}).use('gallery-compare', function(Y) {
var f1 = function () { return 'foo'; }
var f2 = function () { return 'bar'; }
var f3 = function () { return 'foo'; }
Y.log(Y.Compare(f1, f2)) // false
Y.log(Y.Compare(f1, f3)) // true
var o1 = {foo : 'bar', baz : 'boo'}
var o2 = {foo : 'boo', baz : 'bar'}
var o3 = {foo : 'bar', baz : 'boo'}
Y.log(Y.Compare(o1, o2)) // false
Y.log(Y.Compare(o1, o3)) // true
var a1 = ['foo', 'bar', 'baz']
var a2 = ['baz', 'bar', 'foo']
var a3 = ['foo', 'bar', 'baz']
Y.log(Y.Compare(a1, a2)) // false
Y.log(Y.Compare(a1, a3)) // true
Y.log(Y.Compare('foo', 'bar')) // false
var FOO = 'foo'
Y.log(Y.Compare('foo', FOO)) // true
});No forum posts for this module.
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info