array function rename
This commit is contained in:
parent
b86ff252e5
commit
3481c95425
1 changed files with 8 additions and 4 deletions
|
|
@ -7,7 +7,7 @@ from ytdl_sub.script.types.resolvable import Resolvable
|
||||||
|
|
||||||
class ArrayFunctions:
|
class ArrayFunctions:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def extend(*arrays: Array) -> Array:
|
def array_extend(*arrays: Array) -> Array:
|
||||||
output: List[Resolvable] = []
|
output: List[Resolvable] = []
|
||||||
for array in arrays:
|
for array in arrays:
|
||||||
output.extend(array.value)
|
output.extend(array.value)
|
||||||
|
|
@ -15,16 +15,20 @@ class ArrayFunctions:
|
||||||
return Array(output)
|
return Array(output)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def at(array: Array, idx: Integer) -> Resolvable:
|
def array_at(array: Array, idx: Integer) -> Resolvable:
|
||||||
return array.value[idx.value]
|
return array.value[idx.value]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def flatten_array(array: Array) -> Array:
|
def array_flatten(array: Array) -> Array:
|
||||||
output: List[Resolvable] = []
|
output: List[Resolvable] = []
|
||||||
for elem in array.value:
|
for elem in array.value:
|
||||||
if isinstance(elem, Array):
|
if isinstance(elem, Array):
|
||||||
output.extend(ArrayFunctions.flatten_array(elem).value)
|
output.extend(ArrayFunctions.array_flatten(elem).value)
|
||||||
else:
|
else:
|
||||||
output.append(elem)
|
output.append(elem)
|
||||||
|
|
||||||
return Array(output)
|
return Array(output)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def array_reverse(array: Array) -> Array:
|
||||||
|
return Array(list(reversed(array.value)))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue