Recursively transform an object to its Firebase representation
$ npm install object-to-firebase
var objectToFirebase = require('object-to-firebase')
objectToFirebase({
foo: {
bar: null
}
})
// => null
Required
Type: object
Traverses an object
, converting values with value-to-firebase. The object is copied into its smallest possible Firebase representation, meaning:
- Empty objects are removed
null
and values that convert tonull
are removed- These steps are performed recursively
This means the following object become null
:
{
foo: {
bar: {
baz: {}
}
}
}
And this:
{
foo: {
bar: 'hi',
baz: {
qux: null
}
}
}
Becomes this:
{
foo: {
bar: 'hi'
}
}