How to include/import can.Object of canjs, so that can.Object.same would be available to use? -
i cannot create next illustration work @ canjs website: http://canjs.com/docs/can.object.same.html#section_examples
the next page loaded in browser error: 'uncaught typeerror: cannot read property 'same' of undefined'
<!doctype> <html> <head> <title></title> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.js"></script> <script src="http://canjs.com/release/latest/can.jquery.js"></script> </head> <body> <script> can.object.same({ name: "justin" }, { name: "justin" }) //-> false // ignore name property can.object.same({ name: "brian" }, { name: "justin" }, { name: null }) //-> true // ignore case can.object.same({ name: "justin" }, { name: "justin" }, { name: "i" }) //-> true // deep rule can.object.same({ person: { name: "justin"} }, { person: { name: "justin"} }, { person: { name: "i"} }) //-> true // supplied compare function can.object.same({ age: "thirty" }, { age: 30 }, { age: function (a, b) { if (a == "thirty") { = 30 } if (b == "thirty") { b = 30 } homecoming === b; } }) //-> true </script> </body> </html> and tried using requirejs utilize canjs:
var can = requirejs("can"); but it's same thing, can.object still 'undefined'. want utilize can.object.same because of check if 2 objects equal @ value level. didn't utilize underscorejs, otherwise can utilize _.isequal.
====in add-on reply sebastian, if using requirejs, add together "can/util/object" list in require([...]).====
you need load can.object script:
http://canjs.com/release/latest/can.object.js
it needs loaded after can.
canjs canjs-plugin
No comments:
Post a Comment