UNPKG

@zkochan/pnpm

Version:

A fast implementation of npm install

14 lines (11 loc) 367 B
var cache = {} /* * Works identically to require('/path/to/file.json'), but safer. */ module.exports = function requireJson (path, opts) { opts = opts || {} path = require('path').resolve(path) if (!opts.ignoreCache && cache[path]) return cache[path] cache[path] = JSON.parse(require('fs').readFileSync(path, 'utf-8')) return cache[path] }