codecamp

Lodash _.entriesln->toPairsIn

_.toPairsIn(object)

创建一个object对象自身和继承的可枚举属性的键值对数组。这个数组可以通过_.fromPairs撤回。如果object 是 map 或 set,返回其条目。

添加版本

4.0.0

Aliases

_.entriesIn

参数

  1. object (Object): 要检索的对象。

返回

(Array): 返回键值对的数组。

例子

function Foo() {  this.a = 1;  this.b = 2;} Foo.prototype.c = 3; 
_.toPairsIn(new Foo);
// => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)


Lodash _.entries->toPairs
Lodash _.extend->assignIn
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

Lodash 简介

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }