mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-07-01 02:15:42 +00:00
chore: format code
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user