Socket
Socket
Sign inDemoInstall

feathers-batchloader

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

feathers-batchloader

Reducs calls


Version published
Maintainers
1
Created
Source

feathers-batchloader

Build Status Code Climate Test Coverage Dependency Status Download Status

Reducs calls

Installation

npm install feathers-batchloader --save

Documentation

Please refer to the feathers-batchloader documentation for more details.

Complete Example

Here's an example of a Feathers server that uses feathers-batchloader.

const BatchLoader = require('feathers-batchloader');
const { getResultsByKey, getUniqueKeys } = BatchLoader;

const usersBatchLoader = new BatchLoader(
  keys => app.service('users').find({ query: { id: { $in: getUniqueKeys(keys) } } })
    .then(result => getResultsByKey(keys, result, user => user.id, '!'))
);

app.service('comments').find()
  .then(comments => comments.map(comment => {
    // Attach user record
    return usersBatchLoader.load(comment.userId)
      .then(user => comment.userRecord = user);
  }))

License

Copyright (c) 2017 John J. Szwaronek

Licensed under the MIT license.

Keywords

FAQs

Package last updated on 01 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc