memfs
Advanced tools
Comparing version 4.2.1 to 4.2.2
@@ -79,5 +79,3 @@ /// <reference types="node" /> | ||
parent: Link; | ||
children: { | ||
[child: string]: Link | undefined; | ||
}; | ||
children: Map<string, Link | undefined>; | ||
private _steps; | ||
@@ -84,0 +82,0 @@ node: Node; |
@@ -251,3 +251,3 @@ "use strict"; | ||
this._steps = val; | ||
for (const [child, link] of Object.entries(this.children)) { | ||
for (const [child, link] of this.children.entries()) { | ||
if (child === '.' || child === '..') { | ||
@@ -261,3 +261,3 @@ continue; | ||
super(); | ||
this.children = {}; | ||
this.children = new Map(); | ||
// Path to this node as Array: ['usr', 'bin', 'node']. | ||
@@ -285,3 +285,3 @@ this._steps = []; | ||
if (node.isDirectory()) { | ||
link.children['.'] = link; | ||
link.children.set('.', link); | ||
link.getNode().nlink++; | ||
@@ -293,3 +293,3 @@ } | ||
setChild(name, link = new Link(this.vol, this, name)) { | ||
this.children[name] = link; | ||
this.children.set(name, link); | ||
link.parent = this; | ||
@@ -299,3 +299,3 @@ this.length++; | ||
if (node.isDirectory()) { | ||
link.children['..'] = this; | ||
link.children.set('..', this); | ||
this.getNode().nlink++; | ||
@@ -310,6 +310,6 @@ } | ||
if (node.isDirectory()) { | ||
delete link.children['..']; | ||
link.children.delete('..'); | ||
this.getNode().nlink--; | ||
} | ||
delete this.children[link.getName()]; | ||
this.children.delete(link.getName()); | ||
this.length--; | ||
@@ -321,5 +321,3 @@ this.getNode().mtime = new Date(); | ||
this.getNode().mtime = new Date(); | ||
if (Object.hasOwnProperty.call(this.children, name)) { | ||
return this.children[name]; | ||
} | ||
return this.children.get(name); | ||
} | ||
@@ -363,3 +361,3 @@ getPath() { | ||
ino: this.ino, | ||
children: Object.keys(this.children), | ||
children: Array.from(this.children.keys()), | ||
}; | ||
@@ -366,0 +364,0 @@ } |
{ | ||
"name": "memfs", | ||
"version": "4.2.1", | ||
"version": "4.2.2", | ||
"description": "In-memory file-system with Node's fs API.", | ||
@@ -5,0 +5,0 @@ "author": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
899832
12435