Skip to content

Commit

Permalink
Update common_functions.js
Browse files Browse the repository at this point in the history
The "split is not a function" error occurs when we call the split() method on a value that is not of type string. To solve the error, convert the value to a string using the toString() method before calling the split method or make sure to only call the split method on strings.

https://bobbyhadz.com/blog/javascript-typeerror-string-split-is-not-a-function#:~:text=The%20%22split%20is%20not%20a,the%20split%20method%20on%20strings.
  • Loading branch information
AlfCano authored Jun 14, 2022
1 parent cf4f421 commit 0cb668e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion inst/rkward/plugins/common/common_functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ function getDataframe(vars) {
if (Array.isArray(vars)) {
return vars.join().split('[[')[0];
} else {
return vars.split('[[')[0];
return vars.toString().split('[[')[0];
}
}

1 comment on commit 0cb668e

@alfcanr
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, no more "split is not a function" error,

Please sign in to comment.