From fdba2b3c1b3d0ba274271f34727b82b5a79a28f3 Mon Sep 17 00:00:00 2001 From: Rajesh Sharma Date: Tue, 24 Mar 2020 15:16:30 +0545 Subject: [PATCH] ignore empty strings --- lib/utils.js | 3 +++ src/utils.coffee | 2 ++ 2 files changed, 5 insertions(+) diff --git a/lib/utils.js b/lib/utils.js index c84dfeb..81a0fcb 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -64,6 +64,9 @@ exports.changeBaseLocale = function(strs, fromLocale, toLocale) { exports.updateLocalizedStrings = function(strs, updates) { var key, match, regularize, str, update, updateMap, value, _i, _j, _len, _len1; regularize = function(str) { + if (!str) { + return str; + } return str.replace(/\r/g, "").trim(); }; updateMap = {}; diff --git a/src/utils.coffee b/src/utils.coffee index 4e24c99..9fa8b54 100644 --- a/src/utils.coffee +++ b/src/utils.coffee @@ -57,6 +57,8 @@ exports.changeBaseLocale = (strs, fromLocale, toLocale) -> exports.updateLocalizedStrings = (strs, updates) -> # Regularize CR/LF and trim regularize = (str) -> + if not str + return str return str.replace(/\r/g, "").trim() # Map updates by key