Skip to content

Commit

Permalink
Return empty string when there are no arguments (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevva authored and sindresorhus committed Jul 23, 2017
1 parent 5cdd9ed commit e8d28f3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion index.js
Expand Up @@ -152,7 +152,11 @@ function applyStyle() {
// Support varags, but simply cast to string in case there's only one arg
const args = arguments;
const argsLen = args.length;
let str = argsLen !== 0 && String(arguments[0]);
let str = String(arguments[0]);

if (argsLen === 0) {
return '';
}

if (argsLen > 1) {
// Don't slice `arguments`, it prevents V8 optimizations
Expand Down

0 comments on commit e8d28f3

Please sign in to comment.