From a4a55d3c2d9257f434733ff84c999b2e93f07e6f Mon Sep 17 00:00:00 2001 From: kieat Date: Tue, 2 Oct 2018 13:26:45 +0900 Subject: [PATCH] Avoid to pass undefined or null object to Object.keys() If css file doesn't has some of those style classes, the "objRule" would be undefined. --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 88dfedd..0cf2fd1 100644 --- a/index.js +++ b/index.js @@ -4,7 +4,7 @@ var INDENT = ' ' function inlineRule (objRule) { var str = '' - Object.keys(objRule).forEach(function (rule) { + objRule && Object.keys(objRule).forEach(function (rule) { str += rule + ':' + objRule[rule] + ';' }) return str