From fa33461c0b37ac3016274f32c3f335511c8548ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B8=CC=86=20=D0=A8?= =?UTF-8?q?=D0=BA=D0=B0=D1=80=D1=83=D0=BF=D0=B0?= Date: Wed, 28 Jun 2017 14:46:14 +0300 Subject: [PATCH 1/2] Removed deprecated getters from bem-entity-name package --- lib/create-stringify.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/create-stringify.js b/lib/create-stringify.js index e3d557d..5a9fee5 100644 --- a/lib/create-stringify.js +++ b/lib/create-stringify.js @@ -19,11 +19,11 @@ function stringify(entity, delims) { } const modObj = entity.mod; - const modName = (typeof modObj === 'string' ? modObj : modObj && modObj.name) || entity.modName; + const modName = (typeof modObj === 'string' ? modObj : modObj && modObj.name); if (modName) { - const hasModVal = modObj && modObj.hasOwnProperty('val') || entity.hasOwnProperty('modVal'); - const modVal = modObj && modObj.val || entity.modVal; + const hasModVal = modObj && modObj.hasOwnProperty('val'); + const modVal = modObj && modObj.val; if (modVal || modVal === 0 || !hasModVal) { res += delims.mod.name + modName; From a7752569213ca83af9aa1ea9b324c35073c2ba75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B8=CC=86=20=D0=A8?= =?UTF-8?q?=D0=BA=D0=B0=D1=80=D1=83=D0=BF=D0=B0?= Date: Thu, 29 Jun 2017 12:02:50 +0300 Subject: [PATCH 2/2] Restore backward compatibility with old bem-entity-name format as suggested https://github.com/bem-sdk/bem-naming/pull/5#issuecomment-311830692 --- lib/create-stringify.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/create-stringify.js b/lib/create-stringify.js index 5a9fee5..d6ffaa2 100644 --- a/lib/create-stringify.js +++ b/lib/create-stringify.js @@ -19,11 +19,12 @@ function stringify(entity, delims) { } const modObj = entity.mod; - const modName = (typeof modObj === 'string' ? modObj : modObj && modObj.name); + const modName = (typeof modObj === 'string' ? modObj : modObj && modObj.name) + || entity.hasOwnProperty('modName') && entity.modName; if (modName) { - const hasModVal = modObj && modObj.hasOwnProperty('val'); - const modVal = modObj && modObj.val; + const hasModVal = modObj && modObj.hasOwnProperty('val') || entity.hasOwnProperty('modVal'); + const modVal = modObj && modObj.val || entity.modVal; if (modVal || modVal === 0 || !hasModVal) { res += delims.mod.name + modName;