mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2025-04-04 06:00:13 -05:00
[JSInterp] Use ,
for join() with null/undefined argument
Eg: [1,2,3].join(null) -> '1,2,3'
This commit is contained in:
parent
b982d77d0b
commit
1bc45b8b6c
@ -1208,9 +1208,10 @@ class JSInterpreter(object):
|
||||
elif member == 'join':
|
||||
assertion(isinstance(obj, list), 'must be applied on a list')
|
||||
assertion(len(argvals) <= 1, 'takes at most one argument')
|
||||
return (',' if len(argvals) == 0 else argvals[0]).join(
|
||||
('' if x in (None, JS_Undefined) else _js_toString(x))
|
||||
for x in obj)
|
||||
return (',' if len(argvals) == 0 or argvals[0] in (None, JS_Undefined)
|
||||
else argvals[0]).join(
|
||||
('' if x in (None, JS_Undefined) else _js_toString(x))
|
||||
for x in obj)
|
||||
elif member == 'reverse':
|
||||
assertion(not argvals, 'does not take any arguments')
|
||||
obj.reverse()
|
||||
|
Loading…
x
Reference in New Issue
Block a user