iter-tools-es
Version:
The iterable toolbox
30 lines (25 loc) • 646 B
JavaScript
const {
wrapWithIterableIterator
} = require('../../internal/iterable.js');
const {
hasOwnProperty
} = Object.prototype;
function* __objectValues(obj) {
if (obj == null) {
return;
}
for (const key in obj) {
if (hasOwnProperty.call(obj, key)) {
yield obj[key];
}
}
}
exports.__objectValues = __objectValues;
const objectValues = /*#__PURE__*/wrapWithIterableIterator(__objectValues, {
validateArgs(args) {
if (!(args[0] == null || typeof args[0] === 'object')) {
throw new Error('obj argument to objectValues must be an object, null, or undefined');
}
}
});
exports.objectValues = objectValues;