Underscore.JS 对象映射
Underscore.JS有很多易于使用的方法,可以帮助映射对象。本章将详细讨论它们。
Underscore.JS提供了以下各种方法来处理对象映射:
| 序号 | 方法及语法 |
|---|---|
| 1 | keys _.keys(object) |
| 2 | allKeys _.allKeys(object) |
| 3 | values _.values(object) |
| 4 | mapObject _.mapObject(object, iteratee, [context]) |
| 5 | pairs _.pairs(object) |
| 6 | invert _.invert(object) |
| 7 | create _.create(prototype, props) |
| 8 | functions _.functions(object) |
| 9 | findKey _.findKey(object, predicate, [context]) |
极客教程