Skip to content

bendrucker/object-to-firebase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

object-to-firebase Build Status Greenkeeper badge

Recursively transform an object to its Firebase representation

Install

$ npm install object-to-firebase

Usage

var objectToFirebase = require('object-to-firebase')
objectToFirebase({
  foo: {
    bar: null
  }
})
// => null

API

objectToFirebase(object) -> object / null

object

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 to null 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'
  }
}

About

Recursively transform an object to its Firebase representation

Resources

License

Stars

Watchers

Forks

Packages

No packages published