feat: refactoring project

This commit is contained in:
Carlos
2024-11-23 14:56:07 -05:00
parent f0c2a50c18
commit 1c6db5818d
2351 changed files with 39323 additions and 60326 deletions

View File

@@ -10,7 +10,7 @@ exports._resyncList = _resyncList;
exports._resyncParent = _resyncParent;
exports._resyncRemoved = _resyncRemoved;
exports.call = call;
exports.isBlacklisted = exports.isDenylisted = isDenylisted;
exports.isDenylisted = isDenylisted;
exports.popContext = popContext;
exports.pushContext = pushContext;
exports.requeue = requeue;
@@ -61,7 +61,10 @@ function _call(fns) {
function isDenylisted() {
var _this$opts$denylist;
const denylist = (_this$opts$denylist = this.opts.denylist) != null ? _this$opts$denylist : this.opts.blacklist;
return denylist && denylist.indexOf(this.node.type) > -1;
return denylist == null ? void 0 : denylist.includes(this.node.type);
}
{
exports.isBlacklisted = isDenylisted;
}
function restoreContext(path, context) {
if (path.context !== context) {
@@ -82,7 +85,7 @@ function visit() {
return false;
}
const currentContext = this.context;
if (this.shouldSkip || this.call("enter")) {
if (this.shouldSkip || call.call(this, "enter")) {
this.debug("Skip...");
return this.shouldStop;
}
@@ -90,7 +93,7 @@ function visit() {
this.debug("Recursing into...");
this.shouldStop = (0, _traverseNode.traverseNode)(this.node, this.opts, this.scope, this.state, this, this.skipKeys);
restoreContext(this, currentContext);
this.call("exit");
call.call(this, "exit");
return this.shouldStop;
}
function skip() {
@@ -132,7 +135,7 @@ function setContext(context) {
this.state = context.state;
this.opts = context.opts;
}
this.setScope();
setScope.call(this);
return this;
}
function resync() {
@@ -154,14 +157,14 @@ function _resyncKey() {
if (Array.isArray(this.container)) {
for (let i = 0; i < this.container.length; i++) {
if (this.container[i] === this.node) {
this.setKey(i);
setKey.call(this, i);
return;
}
}
} else {
for (const key of Object.keys(this.container)) {
if (this.container[key] === this.node) {
this.setKey(key);
setKey.call(this, key);
return;
}
}
@@ -195,7 +198,7 @@ function setup(parentPath, container, listKey, key) {
this.listKey = listKey;
this.container = container;
this.parentPath = parentPath || this.parentPath;
this.setKey(key);
setKey.call(this, key);
}
function setKey(key) {
var _this$node;