chore: format code

This commit is contained in:
LuanRT
2021-11-02 07:45:16 -03:00
parent 685e14fcc1
commit 94f441a4e2
7 changed files with 72 additions and 72 deletions

View File

@@ -12,7 +12,7 @@ class NToken {
transform(n) {
let n_token = n.split('');
try {
let transformations = this.getTransformationData(this.raw_code);
transformations = transformations.map((el, i) => {
@@ -32,7 +32,7 @@ class NToken {
}
return el;
});
// Fills the null placeholders with a copy of the transformations array.
let null_placeholder_positions = [...this.raw_code.matchAll(this.null_placeholder_regex)].map((item) => parseInt(item[1]));
null_placeholder_positions.forEach((pos) => transformations[pos] = transformations);
@@ -50,11 +50,11 @@ class NToken {
return n_token.join('');
}
getFunc(el) {
return el.match(Constants.FUNCS_REGEX);
}
getTransformationData() {
const data = `[${Utils.getStringBetweenStrings(this.raw_code.replace(/\n/g, ''), 'c=[', '];c')}]`;
return JSON.parse(Constants.formatNTransformData(data));
@@ -66,28 +66,28 @@ class NToken {
this.push(loc[index] = characters[(characters.indexOf(char) - characters.indexOf(this[index]) + 64) % characters.length]);
}, token.split(''));
}
swap0(arr, index) {
const old_value = arr[0];
index = (index % arr.length + arr.length) % arr.length;
arr[0] = arr[index];
arr[index] = old_value;
}
rotate(arr, index) {
index = (index % arr.length + arr.length) % arr.length;
arr.splice(-index).reverse().forEach((el) => arr.unshift(el));
}
splice(arr, index) {
index = (index % arr.length + arr.length) % arr.length;
arr.splice(index, 1);
}
reverse(arr) {
arr.reverse();
}
push(arr, item) {
arr.push(item);
}