Skip to content

8 Utilities

David Grill edited this page Jun 2, 2017 · 2 revisions

Utilities

vue-idb comes with some utilities

  • deepFreeze : Object.freeze recursive
  • arrayMax : Return the max value of an array
  • uuid : return uuid
  • jsUcfirst : Uppercase on the first letter of a word
  • isEmpty : is an object is empty
  • orderBy : order by an array of object
  • filterBy : filter an array of object
  • filterByPromised : filter in an other thread (WebWorker)
import { uuid, deepFreeze, arrayMax, uuid, jsUcfirst, isEmpty, 
orderBy, filterBy, filterByPromised } from 'vue-idb'

const uuid = uuid()
const collection = [
  { id: 1, label: 'Lorem' },
  { id: 2, label: 'Ipsum' },
  { id: 3, label: 'IPv4' }
]
const reverse = true
orderBy(collection, 'label', reverse) // reverse a boolean
filterBy(collection, { label: 'ip' }) // filter is an object
Clone this wiki locally