|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
552 bytes
|
| Line | |
|---|
| 1 | var _getLength = require('./_getLength.js');
|
|---|
| 2 |
|
|---|
| 3 | // Converts lists into objects. Pass either a single array of `[key, value]`
|
|---|
| 4 | // pairs, or two parallel arrays of the same length -- one of keys, and one of
|
|---|
| 5 | // the corresponding values. Passing by pairs is the reverse of `_.pairs`.
|
|---|
| 6 | function object(list, values) {
|
|---|
| 7 | var result = {};
|
|---|
| 8 | for (var i = 0, length = _getLength(list); i < length; i++) {
|
|---|
| 9 | if (values) {
|
|---|
| 10 | result[list[i]] = values[i];
|
|---|
| 11 | } else {
|
|---|
| 12 | result[list[i][0]] = list[i][1];
|
|---|
| 13 | }
|
|---|
| 14 | }
|
|---|
| 15 | return result;
|
|---|
| 16 | }
|
|---|
| 17 |
|
|---|
| 18 | module.exports = object;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.