1.1.4 • Published 10 years ago
value-to-firebase v1.1.4
value-to-firebase 
Convert a JS value into its Firebase representation
Install
$ npm install value-to-firebaseUsage
var valueToFirebase = require('value-to-firebase')
valueToFirebase({}) // => null
valueToFirebase(undefined) // throw!API
valueToFirebase(value) -> any
value
Required
Type: any
undefinedis illegal and triggers an exceptionFunctionis illegal and triggers an exceptionDateandRegExparenullArraybecomes a plain object with numeric keysObjectis:nullif empty (including an emptyArray)- Parsed as a
ServerValueby firebase-server-value where applicable - Invalid and triggers an exception if any key is invalid
- Returned as-is otherwise
Other values (e.g. String and Number) are returned as-is.
Objects are not recursively transformed—only top level keys are evaluated. If you want to recursively transform an object using valueToFirebase, use object-to-firebase.