Have ideas to improve npm?Join in the discussion! »

    clay-resource-collection

    2.0.6 • Public • Published

    clay-resource-collection

    Build Status npm Version JS Standard

    Collection extensions for Clay-Resource

    Installation

    $ npm install clay-resource-collection --save

    Usage

    'use strict'
     
    const { define } = require('clay-resource-collection')
    const { fromDriver } = require('clay-resource')
    const clayDriverMemory = require('clay-driver-memory')
     
    async function tryExample () {
      let driver = clayDriverMemory({})
      let Org = fromDriver(driver, 'Org')
      let User = fromDriver(driver, 'User')
     
      let OrgCollection = define(User)
      let UserCollection = define(Org)
     
      let orgs = new OrgCollection(await Org.list({ filter: {} })
      let users = new UserCollection(await User.list({ filter: {} }))
     
      while (orgs.hasNext) {
        orgs = await orgs.next()
      }
     
    }
     
    tryExample.catch((err) => console.error)
     

    Functions

    Available functions

    Signature Description
    define(-) -> function Define collection for resource

    License

    This software is released under the Apache-2.0 License.

    Links

    Keywords

    Install

    npm i clay-resource-collection

    DownloadsWeekly Downloads

    405

    Version

    2.0.6

    License

    Apache-2.0

    Unpacked Size

    37.1 kB

    Total Files

    28

    Last publish

    Collaborators

    • avatar