UNPKG
imma
Version:
latest (0.0.1)
0.0.1
A collection of functions for dealing with native arrays and objects immutably
imma
/
lib
/
object
/
reduceRight.js
10 lines
(9 loc)
•
252 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
'use strict'
const
reduceRight =
module
.
exports
=
(
object
, fn, initial
) =>
{
let
result = initial
const
keys =
Object
.
keys
(
object
).
reverse
()
for
(
let
key
of
keys) { result =
fn
(result,
object
[key], key,
object
) }
return
result }