Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22394546
flatten-object-to-dot-notation.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
532 B
Referenced Files
None
Subscribers
None
flatten-object-to-dot-notation.js
View Options
module
.
exports
=
function
(
context
,
obj
)
{
const
prefix
=
typeof
context
===
"string"
?
context
+
"."
:
""
;
return
flattenObjectToDotNotation
(
prefix
,
obj
);
};
function
flattenObjectToDotNotation
(
prefix
,
obj
)
{
return
Object
.
keys
(
obj
).
reduce
((
flattened
,
prop
)
=>
{
const
new_prop
=
prefix
+
prop
;
if
(
obj
[
prop
]
&&
typeof
obj
[
prop
]
===
"object"
)
{
Object
.
assign
(
flattened
,
flattenObjectToDotNotation
(
new_prop
+
"."
,
obj
[
prop
])
);
}
else
{
flattened
[
new_prop
]
=
obj
[
prop
];
}
return
flattened
;
},
{});
}
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Fri, Nov 27, 16:18 (1 d, 18 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1223160
Default Alt Text
flatten-object-to-dot-notation.js (532 B)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline