Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

batchdelcache

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

batchdelcache - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

.coveralls.yml

5

batchdelcache.d.ts

@@ -1,3 +0,4 @@

declare function delcache(modulePathArray: string[], all?: boolean = false, rootPath?: string = ''): boolean
export default delcache
declare function batchdelcache(modulePathArray: string[], all?: boolean , rootPath?: string): boolean
export default batchdelcache

9

package.json
{
"name": "batchdelcache",
"version": "0.0.1",
"version": "0.0.2",
"description": "batch delete module cache in node safely",
"main": "batchbdelcache.js",
"types": "batchbdelcache.d.ts",
"scripts": {

@@ -13,3 +14,3 @@ "test": "mocha",

"type": "git",
"url": "git+https://github.com/zhongkai/delcache.git"
"url": "git+https://github.com/NoCoreNode/batchdelcache.git"
},

@@ -19,5 +20,5 @@ "author": "cxtom(cxtom2008@gmail.com)",

"bugs": {
"url": "https://github.com/cxtom/batchdelcache/issues"
"url": "https://github.com/NoCoreNode/batchdelcache/issues"
},
"homepage": "https://github.com/cxtom/batchdelcache#readme",
"homepage": "https://github.com/NoCoreNode/batchdelcache#readme",
"dependencies": {

@@ -24,0 +25,0 @@ "callsite": "^1.0.0"

@@ -1,7 +0,7 @@

# delcache
# batchdelcache
Delete module cache safely. This project is inspired by [decache](https://github.com/dwyl/decache).
[![Build Status](https://travis-ci.org/zhongkai/delcache.svg?branch=master)](https://travis-ci.org/zhongkai/delcache)
[![Coverage Status](https://coveralls.io/repos/github/zhongkai/delcache/badge.svg?branch=master)](https://coveralls.io/github/zhongkai/delcache?branch=master)
[![Build Status](https://travis-ci.org/NoCoreNode/batchdelcache.svg?branch=master)](https://travis-ci.org/NoCoreNode/batchdelcache)
[![Coverage Status](https://coveralls.io/repos/github/NoCoreNode/batchdelcache/badge.svg?branch=master)](https://coveralls.io/github/NoCoreNode/batchdelcache?branch=master)

@@ -12,5 +12,5 @@ ## Installation

# use npm
npm install delcache
npm install batchdelcache
# or use yarn
yarn global add delcache
yarn global add batchdelcache
```

@@ -30,5 +30,5 @@

`delcache` provides a way to eliminate both kinds of reference:
`batchdelcache` provides a way to eliminate both kinds of reference:
`delcache('xxx')`
`batchdelcache('xxx')`

@@ -54,5 +54,5 @@ In most cases, this is enough to clean up all references, with the following exception:

You will find `targetModule` still in the children of `childModuleA` after calling `delcache(targetModule)` in `childModuleB`. In this condition, you can pass `true` as the second argument to `delcache`: `delcache(targetModule, true)`. `delcache` will traverse the whole module tree to delete targetModule from children of every module.
You will find `targetModule` still in the children of `childModuleA` after calling `batchdelcache(targetModule)` in `childModuleB`. In this condition, you can pass `true` as the second argument to `batchdelcache`: `batchdelcache(targetModule, true)`. `batchdelcache` will traverse the whole module tree to delete targetModule from children of every module.
When passing `rootPath` as the third argument, `delcache` will take it as the starting point. It is a recommended way to save time traversing the module tree.
When passing `rootPath` as the third argument, `batchdelcache` will take it as the starting point. It is a recommended way to save time traversing the module tree.

@@ -64,3 +64,3 @@ ## Usage

```js
const delcache = require('delcache')
const batchdelcache = require('batchdelcache')

@@ -71,3 +71,3 @@ let five = require('./five')

delcache('./five')
batchdelcache(['./five'])

@@ -82,13 +82,17 @@ five = require('./five')

```js
const delcache = require('delcache')
const batchdelcache = require('batchdelcache')
let five = require('./five')
let six = require('./six')
five.num = 6
six.sum = 7
delcache('./five', true)
batchdelcache(['./five', './six'], true)
five = require('./five')
six = require('./six')
console.log(five.num) // 5
console.log(six.num) // 6
```

@@ -101,3 +105,3 @@

```js
const delcache = require('delcache')
const batchdelcache = require('batchdelcache')

@@ -108,3 +112,3 @@ let five = require('./five')

delcache('./five', true, '../../root')
batchdelcache('./five', true, '../../root')

@@ -118,3 +122,3 @@ five = require('./five')

Don't uese `delete require.cache[xxx]` with `delcache`, cause `delcache` will check if a module is referenced by `Module._cache`.
Don't uese `delete require.cache[xxx]` with `batchdelcache`, cause `batchdelcache` will check if a module is referenced by `Module._cache`.

@@ -129,4 +133,4 @@ ```js

//b.js
const delcache = require('delcahce')
delcache('./mod', true) // delcache can not eliminate the reference of mod in children of a.js
const batchdelcache = require('batchdelcahce')
batchdelcache('./mod', true) // delcache can not eliminate the reference of mod in children of a.js
```
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