lib/memory.js
function MemoryAdapter(initialFiles) {
    if (!(this instanceof MemoryAdapter)) {
        return new MemoryAdapter(initialFiles);
    }

    this.entries = new Map();

    // load initial file buffers
    if (typeof initialFiles === "object" && initialFiles) {
        Object.keys(initialFiles).forEach((fileName) => {
            const buf = Buffer.from(initialFiles[fileName]);
            this.entries.set(fileName, buf);
        });
    }
}
function MemoryAdapter(initialFiles) {
    if (!(this instanceof MemoryAdapter)) {
        return new MemoryAdapter(initialFiles);
    }

    this.entries = new Map();

    // load initial file buffers
    if (typeof initialFiles === "object" && initialFiles) {
        Object.keys(initialFiles).forEach((fileName) => {
            const buf = Buffer.from(initialFiles[fileName]);
            this.entries.set(fileName, buf);
        });
    }
}
function MemoryAdapter ( initialFiles ) { if ( ! ( this instanceof MemoryAdapter ) ) { return new MemoryAdapter ( initialFiles ) ; } this . entries = new Map ( ) ; // load initial file buffers if ( typeof initialFiles === "object" && initialFiles ) { Object . keys ( initialFiles ) . forEach ( ( fileName ) => { const buf = Buffer . from ( initialFiles [ fileName ] ) ; this . entries . set ( fileName , buf ) ; } ) ; } }
Construct a new MemoryAdapter.

@param {Object.<string, Buffer>} initialFiles The files already in this
virtual directory.
@constructor
Construct a new MemoryAdapter .