Skip to content

Commit

Permalink
replaceAll returns empty string instead of crashing on undefined text
Browse files Browse the repository at this point in the history
Fixes #8
  • Loading branch information
boomzillawtf committed Mar 18, 2018
1 parent 397f870 commit 70e1b94
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Search in the

## Changes

0.6.7
- Unavailable videos don't have a channel name, replaceAll checks for no text.
0.6.6
- Rejected videos lack thumbnails, too.
0.6.5
Expand Down
3 changes: 3 additions & 0 deletions library.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ YoutubeLite.fetchSnippet = function( videoId, callback ){
}

function replaceAll(text, search, replace) {
if( !text ){
return '';
}
if (replace === undefined) {
return text.toString();
}
Expand Down

0 comments on commit 70e1b94

Please sign in to comment.