|
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 _cb = require('./_cb.js');
|
|---|
| 2 | var keys = require('./keys.js');
|
|---|
| 3 |
|
|---|
| 4 | // Returns the results of applying the `iteratee` to each element of `obj`.
|
|---|
| 5 | // In contrast to `_.map` it returns an object.
|
|---|
| 6 | function mapObject(obj, iteratee, context) {
|
|---|
| 7 | iteratee = _cb(iteratee, context);
|
|---|
| 8 | var _keys = keys(obj),
|
|---|
| 9 | length = _keys.length,
|
|---|
| 10 | results = {};
|
|---|
| 11 | for (var index = 0; index < length; index++) {
|
|---|
| 12 | var currentKey = _keys[index];
|
|---|
| 13 | results[currentKey] = iteratee(obj[currentKey], currentKey, obj);
|
|---|
| 14 | }
|
|---|
| 15 | return results;
|
|---|
| 16 | }
|
|---|
| 17 |
|
|---|
| 18 | module.exports = mapObject;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.