Socket
Socket
Sign inDemoInstall

dataloader

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dataloader - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

22

dist/index.js

@@ -180,2 +180,24 @@

}
/**
* Adds the provied key and value to the cache. If the key already exists, no
* change is made. Returns itself for method chaining.
*/
}, {
key: 'prime',
value: function prime(key, value) {
var cacheKeyFn = this._options && this._options.cacheKeyFn;
var cacheKey = cacheKeyFn ? cacheKeyFn(key) : key;
// Only add the key if it does not already exist.
if (this._promiseCache.get(cacheKey) === undefined) {
// Cache a rejected promise if the value is an Error, in order to match
// the behavior of load(key).
var promise = value instanceof Error ? Promise.reject(value) : Promise.resolve(value);
this._promiseCache.set(cacheKey, promise);
}
return this;
}
}]);

@@ -182,0 +204,0 @@

4

package.json
{
"name": "dataloader",
"version": "1.1.0",
"version": "1.2.0",
"description": "A data loading utility to reduce requests to a backend via batching and caching.",

@@ -45,3 +45,3 @@ "contributors": [

"babel-core": "5.8.22",
"babel-eslint": "4.1.6",
"babel-eslint": "4.1.8",
"chai": "3.4.1",

@@ -48,0 +48,0 @@ "coveralls": "2.11.6",

@@ -199,3 +199,9 @@ # DataLoader

##### `prime(key, value)`
Primes the cache with the provided key and value. If the key already exists, no
change is made. (To forcefully prime the cache, clear the key first with
`loader.clear(key).prime(key, value)`.) Returns itself for method chaining.
## Using with GraphQL

@@ -411,4 +417,9 @@

## Video Source Code Walkthrough
**DataLoader Source Code Walkthrough (YouTube):**
<a href="https://youtu.be/OQTnXNCDywA" target="_blank" alt="DataLoader Source Code Walkthrough"><img src="https://img.youtube.com/vi/OQTnXNCDywA/0.jpg" /></a>
[@schrockn]: https://github.com/schrockn

@@ -415,0 +426,0 @@ [Map]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map

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