Skip to content

Commit f13b47d

Browse files
authored
[file_packager] Remove redundant toString (#22829)
Location.pathname is defined as a string: https://developer.mozilla.org/en-US/docs/Web/API/Location/pathname
1 parent 974ede7 commit f13b47d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/file_packager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -761,10 +761,10 @@ def generate_js(data_target, data_files, metadata):
761761
ret += '''
762762
var PACKAGE_PATH = '';
763763
if (typeof window === 'object') {
764-
PACKAGE_PATH = window['encodeURIComponent'](window.location.pathname.toString().substring(0, window.location.pathname.toString().lastIndexOf('/')) + '/');
764+
PACKAGE_PATH = window['encodeURIComponent'](window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/')) + '/');
765765
} else if (typeof process === 'undefined' && typeof location !== 'undefined') {
766766
// web worker
767-
PACKAGE_PATH = encodeURIComponent(location.pathname.toString().substring(0, location.pathname.toString().lastIndexOf('/')) + '/');
767+
PACKAGE_PATH = encodeURIComponent(location.pathname.substring(0, location.pathname.lastIndexOf('/')) + '/');
768768
}
769769
var PACKAGE_NAME = '%s';
770770
var REMOTE_PACKAGE_BASE = '%s';

0 commit comments

Comments
 (0)