Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // o.hasOwnProperty можно переопределить
- function hasOwn(o, p) {
- return Object.prototype.hasOwnProperty.call(o, p);
- }
- // each(obj, function (value, index, obj) {}[, thisArg=obj])
- function each(o, cb, s) {
- var i;
- s = s || o;
- if (typeof o.length != 'undefined') {
- for (i = 0; i < o.length; ++i) {
- if (cb.call(s, o[i], i, o) === false) {
- break;
- }
- }
- } else {
- for (i in o) {
- if (hasOwn(o, i)) {
- if (cb.call(s, o[i], i, o) === false) {
- break;
- }
- }
- }
- }
- return o;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement