1
0
forked from dyf/APP
Files
APP/node_modules/es5-ext/object/_iterate.js
liubiao 70651b81f5 revert e5e2aca0c4
revert Merge branch 'main' of http://47.107.152.87:3000/liubiao/APP

# Conflicts:
#	.gitignore
#	pages/common/index/index.vue
#	unpackage/dist/dev/app-plus/app-config-service.js
#	unpackage/dist/dev/app-plus/app-service.js
#	unpackage/dist/dev/app-plus/app-view.js
#	unpackage/dist/dev/app-plus/manifest.json
#	utils/request.js
2025-07-31 10:59:29 +08:00

31 lines
1.1 KiB
JavaScript

// Internal method, used by iteration functions.
// Calls a function for each key-value pair found in object
// Optionally takes compareFn to iterate object in specific order
"use strict";
var callable = require("./valid-callable")
, value = require("./valid-value")
, bind = Function.prototype.bind
, call = Function.prototype.call
, keys = Object.keys
, objPropertyIsEnumerable = Object.prototype.propertyIsEnumerable;
module.exports = function (method, defVal) {
return function (obj, cb /*, thisArg, compareFn*/) {
var list, thisArg = arguments[2], compareFn = arguments[3];
obj = Object(value(obj));
callable(cb);
list = keys(obj);
if (compareFn) {
list.sort(typeof compareFn === "function" ? bind.call(compareFn, obj) : undefined);
}
if (typeof method !== "function") method = list[method];
return call.call(method, list, function (key, index) {
if (!objPropertyIsEnumerable.call(obj, key)) return defVal;
return call.call(cb, thisArg, obj[key], key, obj, index);
});
};
};