New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

memoize-fs

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

memoize-fs - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

4

CHANGELOG.md

@@ -0,1 +1,5 @@

### 1.2.0 (2017-08-26)
* added astBody option
### 1.1.0 (2017-02-05)

@@ -2,0 +6,0 @@

11

index.js

@@ -9,2 +9,3 @@ 'use strict'

var crypto = require('crypto')
var parseScript = require('shift-parser').parseScript

@@ -53,9 +54,5 @@ module.exports = function (options) {

var salt = opt.salt || ''
var fnStr = (opt.noBody ? '' : String(fn))
var argsStr
var hash
argsStr = serialize(args)
hash = crypto.createHash('md5').update(fnStr + argsStr + salt).digest('hex')
var fnStr = (opt.noBody ? '' : opt.astBody ? JSON.stringify(parseScript(String(fn))) : String(fn))
var argsStr = serialize(args)
var hash = crypto.createHash('md5').update(fnStr + argsStr + salt).digest('hex')
return path.join(options.cachePath, opt.cacheId, hash)

@@ -62,0 +59,0 @@ }

{
"name": "memoize-fs",
"version": "1.1.0",
"version": "1.2.0",
"description": "memoize/cache in file system solution for Node.js",

@@ -28,3 +28,4 @@ "author": "Boris Diakur <contact@borisdiakur.com> (https://github.com/borisdiakur)",

"mkdirp": "^0.5.0",
"rimraf": "^2.4.0"
"rimraf": "^2.4.0",
"shift-parser": "^5.0.7"
},

@@ -31,0 +32,0 @@ "devDependencies": {

@@ -51,3 +51,3 @@ # memoize-fs

__Note that a result of a momoized function is always a [Promise](http://www.html5rocks.com/en/tutorials/es6/promises/) instance!__
__Note that a result of a memoized function is always a [Promise](http://www.html5rocks.com/en/tutorials/es6/promises/) instance!__

@@ -113,3 +113,3 @@ ### Memoizing asynchronous functions

The `cacheId` option which you can specify during momoization of a function resolves to the name of a subfolder created inside the root cache folder.
The `cacheId` option which you can specify during memoization of a function resolves to the name of a subfolder created inside the root cache folder.
Cached function calls will be cached inside that folder:

@@ -148,2 +148,10 @@

#### astBody
If you want to use the function AST instead the function body when generating the hash ([see serialization](#serialization)), set the option `astBody` to `true`. This allows the function source code to be reformatted without busting the cache. See https://github.com/borisdiakur/memoize-fs/issues/6 for details.
```javascript
memoize.fn(fun, { astBody: true }).then(...
```
#### noBody

@@ -150,0 +158,0 @@

Sorry, the diff of this file is not supported yet

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