From 040c919e284a7817cac46554877e21572b747eb8 Mon Sep 17 00:00:00 2001 From: cueedee Date: Tue, 12 May 2015 10:24:42 +0200 Subject: [PATCH] fix(utils): ensure string methods apply to strings --- lib/youtil.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/youtil.js b/lib/youtil.js index cc0f0313..fcc66509 100644 --- a/lib/youtil.js +++ b/lib/youtil.js @@ -8,7 +8,7 @@ module.exports = { isIdentifier: function ( value ) { - return /^[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*$/.test( value.trim() ); + return /^[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*$/.test(( '' + value ).trim() ); } , isNonBlank: function ( value ) @@ -21,7 +21,7 @@ module.exports = // , isNpmName: function ( value ) { - return value === encodeURIComponent( value ) && value === value.toLowerCase(); + return value === encodeURIComponent( value ) && value === ( '' + value ).toLowerCase(); } , sentencify: function ( value )