UNPKG

memoized-node-fetch

Version:

A wrapper around node-fetch that caches the request's promise before resolving.

19 lines 544 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function requestToHash(url, options) { return stringToHash(url.toString() + JSON.stringify(options)); } exports.default = requestToHash; function stringToHash(string) { let hash = 0; if (string.length === 0) { return hash; } for (let i = 0; i < string.length; i++) { const char = string.charCodeAt(i); hash = (hash << 5) - hash + char; hash = hash & hash; } return hash; } //# sourceMappingURL=hasher.js.map