UNPKG

lenye_base

Version:

基础方法

22 lines (16 loc) 430 B
import './get_tag.js'; import isObject from './is_object.js'; import isFunction from './is_function.js'; function entries(obj) { if (!isObject(obj) && !isFunction(obj) || obj === null) { throw new Error('argument to `entries` must be an object'); } var result = []; for (var key in obj) { if (obj.hasOwnProperty(key)) { result.push([key, obj[key]]); } } return result; } export default entries;