Blame view

node_modules/require-uncached/readme.md 833 Bytes
f7563de62   Palak Handa   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
  # require-uncached [![Build Status](https://travis-ci.org/sindresorhus/require-uncached.svg?branch=master)](https://travis-ci.org/sindresorhus/require-uncached)
  
  > Require a module bypassing the [cache](https://nodejs.org/api/modules.html#modules_caching)
  
  Useful for testing purposes when you need to freshly require a module.
  
  
  ## Install
  
  ```
  $ npm install --save require-uncached
  ```
  
  
  ## Usage
  
  ```js
  // foo.js
  let i = 0;
  module.exports = () => ++i;
  ```
  
  ```js
  const requireUncached = require('require-uncached');
  
  require('./foo')();
  //=> 1
  
  require('./foo')();
  //=> 2
  
  requireUncached('./foo')();
  //=> 1
  
  requireUncached('./foo')();
  //=> 1
  ```
  
  
  ## Related
  
  - [clear-require](https://github.com/sindresorhus/clear-require) - Clear a module from the require cache
  
  
  ## License
  
  MIT © [Sindre Sorhus](https://sindresorhus.com)