|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
495 bytes
|
| Line | |
|---|
| 1 | import { identity } from '../../function/identity.mjs';
|
|---|
| 2 |
|
|---|
| 3 | function forInRight(object, iteratee = identity) {
|
|---|
| 4 | if (object == null) {
|
|---|
| 5 | return object;
|
|---|
| 6 | }
|
|---|
| 7 | const keys = [];
|
|---|
| 8 | for (const key in object) {
|
|---|
| 9 | keys.push(key);
|
|---|
| 10 | }
|
|---|
| 11 | for (let i = keys.length - 1; i >= 0; i--) {
|
|---|
| 12 | const key = keys[i];
|
|---|
| 13 | const result = iteratee(object[key], key, object);
|
|---|
| 14 | if (result === false) {
|
|---|
| 15 | break;
|
|---|
| 16 | }
|
|---|
| 17 | }
|
|---|
| 18 | return object;
|
|---|
| 19 | }
|
|---|
| 20 |
|
|---|
| 21 | export { forInRight };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.