Usage
This documentation still in development.
import collect from '@eloqjs/collection'
const collection = collect(posts)
.where('status', 'published')
.sortBy('-publishedAt')
import { Collection } from '@eloqjs/collection'
const collection = new Collection(posts)
.where('status', 'published')
.sortBy('-publishedAt')
Frameworks
Nuxt
The module globally injects $collect
instance, meaning that you can access it anywhere
using this.$collect
. For plugins, asyncData, nuxtServerInit and Middleware, you can access it from context.$collect
.
const collection = this.$collect(posts)
.where('status', 'published')
.sortBy('-publishedAt')
const collection = context.$collect(posts)
.where('status', 'published')
.sortBy('-publishedAt')
Vue
The plugin globally injects $collect
instance, meaning that you can access it anywhere
using this.$collect
. You can also access it from Vue.collect
.
const collection = this.$collect(posts)
.where('status', 'published')
.sortBy('-publishedAt')
const collection = Vue.collect(posts)
.where('status', 'published')
.sortBy('-publishedAt')
Methods
This documentation still in development. Not all methods are yet listed.