uniqueSet = (path, value, onComplete) =>
    firebase
      .database()
      .ref(path)
      .transaction((d) => (d === null ? value : undefined))
      .then(({ committed, snapshot }) => {
        if (!committed) {
          const newError = new Error('Path already exists.')
          if (onComplete) onComplete(newError)
          return Promise.reject(newError)
        }
        if (onComplete) onComplete(snapshot)
        return snapshot
      })
Sets data to Firebase only if the path does not already
exist, otherwise it rejects. Internally uses a Firebase transaction to
prevent a race condition between seperate clients calling uniqueSet.
@param {string} path - Path to location on Firebase which to set
@param {object|string|boolean|number} value - Value to write to Firebase
@param {Function} onComplete - Function to run on complete (`not required`)
@returns {Promise} Containing reference snapshot
@see https://react-redux-firebase.com/docs/api/firebaseInstance.html#uniqueset
@example <caption>Basic</caption>
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { firebaseConnect } from 'react-redux-firebase'

function Example({ firebase: { uniqueSet } }) {
  return (
    <button onClick={() => uniqueSet('some/unique/path', true)}>
      Unique Set To Firebase
    </button>
  )
}
export default firebaseConnect()(Example)