ReBase
Documentation


Utils

When importing from the ./rebase-ui-utils module, the following named exports are available:

They can be imported like this:


import { html, Component } from './rebase-ui-runtime'
import { Action, Query, ValidateEmail, DeepMerge } from './rebase-ui-utils'

export default class MyView extends Component {
  // ...
}

ValidateEmail

Is a function which returns true when the given string looks like an email. Internally validated with the following regex: /[a-z0-9-._]+@[a-z0-9-]+[-._][a-z0-9]+/i

DeepMerge

Is a function that takes two objects as arguments and returns a deep copy of both objects.


import { DeepMerge } from './rebase-ui-utils'
const objectA = {
  a: {
    a: 1
  }
}
const objectB = {
  a: {
    b: 2
  },
  b: {
    b: 3
  }
}
const objectC = DeepMerge(objectA, objectB)
// objectC:
// {
//  a: {
//   a: 1,
//   b: 2
//  },
//  b: {
//   b: 3
//  }
// }

Properties of the second object will overwrite properties of the first object in the merged result.