@canopycanopycanopy/b-ber-grammar-attributes 2.0.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +11 -9
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -40,8 +40,6 @@ var _lodash = _interopRequireDefault(require("lodash.has"));
40
40
 
41
41
  var _bBerLib = require("@canopycanopycanopy/b-ber-lib");
42
42
 
43
- var _utils = require("@canopycanopycanopy/b-ber-lib/utils");
44
-
45
43
  var _bBerLogger = _interopRequireDefault(require("@canopycanopycanopy/b-ber-logger"));
46
44
 
47
45
  var _bBerShapesDirectives = require("@canopycanopycanopy/b-ber-shapes-directives");
@@ -68,11 +66,11 @@ const _isUnsupportedAttribute = (genus, attr) => {
68
66
  let key;
69
67
 
70
68
  if (_bBerShapesDirectives.BLOCK_DIRECTIVES.has(genus)) {
71
- // these are all containers which share the same attributes, so they're
69
+ // These are all containers which share the same attributes, so they're
72
70
  // grouped under a single property
73
71
  key = 'block';
74
72
  } else {
75
- // this will be the directive name, e.g., figure, video, etc
73
+ // This will be the directive name, e.g., figure, video, etc
76
74
  key = genus;
77
75
  }
78
76
 
@@ -275,13 +273,17 @@ const attributesObject = (attrs, origGenus, context = {}) => {
275
273
  }
276
274
 
277
275
  if (attrs && typeof attrs === 'string') {
278
- (0, _utils.forOf)(parseAttrs((0, _trim.default)(attrs).call(attrs)), (k, v) => {
279
- if (_isUnsupportedAttribute(genus, k)) {
280
- return _bBerLogger.default.warn(`render omitting unsupported attribute [${k}] at [${fileName}:${lineNumber}]`);
276
+ const parsedAttrs = (0, _entries.default)(parseAttrs((0, _trim.default)(attrs).call(attrs))); // eslint-disable-next-line no-unused-vars
277
+
278
+ for (const [key, val] of parsedAttrs) {
279
+ if (_isUnsupportedAttribute(genus, key)) {
280
+ _bBerLogger.default.warn(`render omitting unsupported attribute [${key}] at [${fileName}:${lineNumber}]`);
281
+
282
+ continue;
281
283
  }
282
284
 
283
- attrsObject[k] = v;
284
- });
285
+ attrsObject[key] = val;
286
+ }
285
287
  } // Add original `origGenus` as a class to the attrs object in case it's
286
288
  // different from the current `genus` (which might've changed due to it's
287
289
  // specification). do this to keep styling consistent
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canopycanopycanopy/b-ber-grammar-attributes",
3
- "version": "2.0.0",
3
+ "version": "3.0.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -17,9 +17,9 @@
17
17
  "access": "public"
18
18
  },
19
19
  "dependencies": {
20
- "@canopycanopycanopy/b-ber-lib": "2.0.0",
21
- "@canopycanopycanopy/b-ber-logger": "2.0.0",
22
- "@canopycanopycanopy/b-ber-shapes-directives": "2.0.0",
20
+ "@canopycanopycanopy/b-ber-lib": "3.0.0",
21
+ "@canopycanopycanopy/b-ber-logger": "3.0.0",
22
+ "@canopycanopycanopy/b-ber-shapes-directives": "3.0.0",
23
23
  "lodash": "^4.17.21",
24
24
  "lodash.has": "latest",
25
25
  "tar": "^6.1.11"
@@ -49,5 +49,5 @@
49
49
  "url": "https://maxwellsimmer.com"
50
50
  }
51
51
  ],
52
- "gitHead": "dbeae192709705f5bc211195ff343cbd999f9caf"
52
+ "gitHead": "676dbec7fbdcc46eb8168f1d437d294ed549e2e8"
53
53
  }