From e8d28f3041251c650ee05b4cdd34a3ff95754d02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=20M=C3=A5rtensson?= Date: Sun, 23 Jul 2017 22:13:55 +0200 Subject: [PATCH] Return empty `string` when there are no arguments (#183) --- index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index f98f65a..87300fc 100644 --- a/index.js +++ b/index.js @@ -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