style-dictionary 3.7.3-rc.1 → 3.8.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 (30) hide show
  1. package/README.md +4 -4
  2. package/examples/advanced/assets-base64-embed/package.json +1 -1
  3. package/examples/advanced/auto-rebuild-watcher/package.json +1 -1
  4. package/examples/advanced/component-cti/package.json +1 -1
  5. package/examples/advanced/create-react-app/package.json +1 -1
  6. package/examples/advanced/create-react-native-app/package.json +1 -1
  7. package/examples/advanced/custom-file-header/package.json +1 -1
  8. package/examples/advanced/custom-filters/package.json +1 -1
  9. package/examples/advanced/custom-formats-with-templates/package.json +1 -1
  10. package/examples/advanced/custom-parser/package.json +1 -1
  11. package/examples/advanced/custom-transforms/package.json +1 -1
  12. package/examples/advanced/font-face-rules/package.json +1 -1
  13. package/examples/advanced/format-helpers/package.json +1 -1
  14. package/examples/advanced/matching-build-files/package.json +1 -1
  15. package/examples/advanced/multi-brand-multi-platform/package.json +1 -1
  16. package/examples/advanced/node-modules-as-config-and-properties/package.json +1 -1
  17. package/examples/advanced/npm-module/package.json +1 -1
  18. package/examples/advanced/referencing_aliasing/package.json +1 -1
  19. package/examples/advanced/s3/package.json +1 -1
  20. package/examples/advanced/tokens-deprecation/package.json +1 -1
  21. package/examples/advanced/transitive-transforms/package.json +1 -1
  22. package/examples/advanced/variables-in-outputs/package.json +1 -1
  23. package/examples/advanced/yaml-tokens/package.json +1 -1
  24. package/lib/common/formats.js +35 -21
  25. package/lib/common/templates/flutter/class.dart.template +1 -1
  26. package/lib/common/transforms.js +15 -15
  27. package/lib/register/action.js +6 -6
  28. package/lib/register/filter.js +4 -4
  29. package/lib/register/format.js +4 -4
  30. package/package.json +1 -1
package/README.md CHANGED
@@ -280,11 +280,11 @@ const StyleDictionary = require('style-dictionary').extend('config.json');
280
280
  StyleDictionary.registerTransform({
281
281
  name: 'time/seconds',
282
282
  type: 'value',
283
- matcher: function(prop) {
284
- return prop.attributes.category === 'time';
283
+ matcher: function(token) {
284
+ return token.attributes.category === 'time';
285
285
  },
286
- transformer: function(prop) {
287
- return (parseInt(prop.original.value) / 1000).toString() + 's';
286
+ transformer: function(token) {
287
+ return (parseInt(token.original.value) / 1000).toString() + 's';
288
288
  }
289
289
  });
290
290
 
@@ -11,6 +11,6 @@
11
11
  "author": "",
12
12
  "license": "Apache-2.0",
13
13
  "devDependencies": {
14
- "style-dictionary": "3.7.2"
14
+ "style-dictionary": "3.8.0"
15
15
  }
16
16
  }
@@ -17,6 +17,6 @@
17
17
  "license": "Apache-2.0",
18
18
  "devDependencies": {
19
19
  "chokidar-cli": "^1.2.0",
20
- "style-dictionary": "3.7.2"
20
+ "style-dictionary": "3.8.0"
21
21
  }
22
22
  }
@@ -15,6 +15,6 @@
15
15
  "author": "",
16
16
  "license": "Apache-2.0",
17
17
  "devDependencies": {
18
- "style-dictionary": "3.7.2"
18
+ "style-dictionary": "3.8.0"
19
19
  }
20
20
  }
@@ -10,7 +10,7 @@
10
10
  "styled-components": "^5.3.0"
11
11
  },
12
12
  "devDependencies": {
13
- "style-dictionary": "3.7.2"
13
+ "style-dictionary": "3.8.0"
14
14
  },
15
15
  "resolutions": {
16
16
  "immer": "8.0.1",
@@ -27,7 +27,7 @@
27
27
  "babel-jest": "~25.2.6",
28
28
  "jest": "~25.2.6",
29
29
  "react-test-renderer": "~16.13.1",
30
- "style-dictionary": "3.7.2"
30
+ "style-dictionary": "3.8.0"
31
31
  },
32
32
  "jest": {
33
33
  "preset": "react-native"
@@ -10,6 +10,6 @@
10
10
  "author": "",
11
11
  "license": "ISC",
12
12
  "devDependencies": {
13
- "style-dictionary": "3.7.2"
13
+ "style-dictionary": "3.8.0"
14
14
  }
15
15
  }
@@ -15,6 +15,6 @@
15
15
  "author": "",
16
16
  "license": "Apache-2.0",
17
17
  "devDependencies": {
18
- "style-dictionary": "3.7.2"
18
+ "style-dictionary": "3.8.0"
19
19
  }
20
20
  }
@@ -18,6 +18,6 @@
18
18
  "handlebars": "^4.7.7",
19
19
  "lodash": "^4.17.21",
20
20
  "pug": "^3.0.2",
21
- "style-dictionary": "3.7.2"
21
+ "style-dictionary": "3.8.0"
22
22
  }
23
23
  }
@@ -9,6 +9,6 @@
9
9
  "author": "",
10
10
  "license": "Apache-2.0",
11
11
  "devDependencies": {
12
- "style-dictionary": "3.7.2"
12
+ "style-dictionary": "3.8.0"
13
13
  }
14
14
  }
@@ -15,6 +15,6 @@
15
15
  "author": "",
16
16
  "license": "Apache-2.0",
17
17
  "devDependencies": {
18
- "style-dictionary": "3.7.2"
18
+ "style-dictionary": "3.8.0"
19
19
  }
20
20
  }
@@ -8,6 +8,6 @@
8
8
  },
9
9
  "license": "Apache-2.0",
10
10
  "devDependencies": {
11
- "style-dictionary": "3.7.2"
11
+ "style-dictionary": "3.8.0"
12
12
  }
13
13
  }
@@ -10,6 +10,6 @@
10
10
  "author": "",
11
11
  "license": "Apache-2.0",
12
12
  "devDependencies": {
13
- "style-dictionary": "3.7.2"
13
+ "style-dictionary": "3.8.0"
14
14
  }
15
15
  }
@@ -16,6 +16,6 @@
16
16
  "author": "Kelly Harrop <kn.harrop@gmail.com>",
17
17
  "license": "Apache-2.0",
18
18
  "devDependencies": {
19
- "style-dictionary": "3.7.2"
19
+ "style-dictionary": "3.8.0"
20
20
  }
21
21
  }
@@ -15,6 +15,6 @@
15
15
  "author": "",
16
16
  "license": "Apache-2.0",
17
17
  "devDependencies": {
18
- "style-dictionary": "3.7.2"
18
+ "style-dictionary": "3.8.0"
19
19
  }
20
20
  }
@@ -19,7 +19,7 @@
19
19
  },
20
20
  "homepage": "https://github.com/dbanksdesign/style-dictionary-node#readme",
21
21
  "devDependencies": {
22
- "style-dictionary": "3.7.2",
22
+ "style-dictionary": "3.8.0",
23
23
  "tinycolor2": "^1.4.1"
24
24
  }
25
25
  }
@@ -16,6 +16,6 @@
16
16
  "author": "",
17
17
  "license": "Apache-2.0",
18
18
  "devDependencies": {
19
- "style-dictionary": "3.7.2"
19
+ "style-dictionary": "3.8.0"
20
20
  }
21
21
  }
@@ -15,6 +15,6 @@
15
15
  "author": "",
16
16
  "license": "Apache-2.0",
17
17
  "devDependencies": {
18
- "style-dictionary": "3.7.2"
18
+ "style-dictionary": "3.8.0"
19
19
  }
20
20
  }
@@ -15,6 +15,6 @@
15
15
  "devDependencies": {
16
16
  "aws-sdk": "^2.7.21",
17
17
  "fs-extra": "^1.0.0",
18
- "style-dictionary": "3.7.2"
18
+ "style-dictionary": "3.8.0"
19
19
  }
20
20
  }
@@ -16,6 +16,6 @@
16
16
  "license": "Apache-2.0",
17
17
  "devDependencies": {
18
18
  "lodash": "^4.17.11",
19
- "style-dictionary": "3.7.2"
19
+ "style-dictionary": "3.8.0"
20
20
  }
21
21
  }
@@ -11,6 +11,6 @@
11
11
  "license": "ISC",
12
12
  "devDependencies": {
13
13
  "chroma-js": "^2.1.0",
14
- "style-dictionary": "3.7.2"
14
+ "style-dictionary": "3.8.0"
15
15
  }
16
16
  }
@@ -10,6 +10,6 @@
10
10
  "author": "",
11
11
  "license": "MIT",
12
12
  "devDependencies": {
13
- "style-dictionary": "3.7.2"
13
+ "style-dictionary": "3.8.0"
14
14
  }
15
15
  }
@@ -9,7 +9,7 @@
9
9
  "author": "",
10
10
  "license": "Apache-2.0",
11
11
  "devDependencies": {
12
- "style-dictionary": "3.7.2",
12
+ "style-dictionary": "3.8.0",
13
13
  "yaml": "^1.10.0"
14
14
  }
15
15
  }
@@ -15,7 +15,18 @@ const fs = require('fs');
15
15
  const path = require('path');
16
16
  const _template = require('lodash/template');
17
17
  const GroupMessages = require('../utils/groupMessages');
18
- const { fileHeader, formattedVariables, getTypeScriptType, iconsWithPrefix, minifyDictionary, sortByReference, createPropertyFormatter, sortByName, setSwiftFileProperties, setComposeObjectProperties } = require('./formatHelpers');
18
+ const {
19
+ fileHeader,
20
+ formattedVariables,
21
+ getTypeScriptType,
22
+ iconsWithPrefix,
23
+ minifyDictionary,
24
+ sortByReference,
25
+ createPropertyFormatter,
26
+ sortByName,
27
+ setSwiftFileProperties,
28
+ setComposeObjectProperties
29
+ } = require('./formatHelpers');
19
30
 
20
31
  const SASS_MAP_FORMAT_DEPRECATION_WARNINGS = GroupMessages.GROUP.SassMapFormatDeprecationWarnings;
21
32
 
@@ -140,7 +151,7 @@ module.exports = {
140
151
  'scss/variables': function({dictionary, options, file}) {
141
152
  const { outputReferences, themeable = false } = options;
142
153
  return fileHeader({file, commentStyle: 'short'}) +
143
- formattedVariables({format: 'sass', dictionary, outputReferences, themeable});
154
+ formattedVariables({format: 'sass', dictionary, outputReferences, themeable}) + '\n';
144
155
  },
145
156
 
146
157
  /**
@@ -175,7 +186,7 @@ module.exports = {
175
186
  'less/variables': function({dictionary, options, file}) {
176
187
  const { outputReferences } = options;
177
188
  return fileHeader({file, commentStyle: 'short'}) +
178
- formattedVariables({format: 'less', dictionary, outputReferences});
189
+ formattedVariables({format: 'less', dictionary, outputReferences}) + '\n';
179
190
  },
180
191
 
181
192
  /**
@@ -207,7 +218,7 @@ module.exports = {
207
218
  'stylus/variables': function({dictionary, options, file}) {
208
219
  const { outputReferences } = options;
209
220
  return fileHeader({file, commentStyle: 'short'}) +
210
- formattedVariables({format: 'stylus', dictionary, outputReferences});
221
+ formattedVariables({format: 'stylus', dictionary, outputReferences}) + '\n';
211
222
  },
212
223
 
213
224
  /**
@@ -231,7 +242,7 @@ module.exports = {
231
242
  'javascript/module': function({dictionary, file}) {
232
243
  return fileHeader({file}) +
233
244
  'module.exports = ' +
234
- JSON.stringify(dictionary.tokens, null, 2) + ';';
245
+ JSON.stringify(dictionary.tokens, null, 2) + ';\n';
235
246
  },
236
247
 
237
248
  /**
@@ -248,8 +259,9 @@ module.exports = {
248
259
  */
249
260
  'javascript/module-flat': function({dictionary, file}) {
250
261
  return fileHeader({file}) +
251
- 'module.exports = ' +
252
- module.exports['json/flat']({dictionary}) + ';';
262
+ 'module.exports = ' + '{\n' + dictionary.allTokens.map(function(token) {
263
+ return ` "${token.name}": ${JSON.stringify(token.value)}`;
264
+ }).join(',\n') + '\n}' + ';\n';
253
265
  },
254
266
 
255
267
  /**
@@ -277,7 +289,7 @@ module.exports = {
277
289
  (file.name || '_styleDictionary') +
278
290
  ' = ' +
279
291
  JSON.stringify(dictionary.tokens, null, 2) +
280
- ';';
292
+ ';\n';
281
293
  },
282
294
 
283
295
  /**
@@ -367,7 +379,7 @@ module.exports = {
367
379
  if (token.comment)
368
380
  to_ret = to_ret.concat(' // ' + token.comment);
369
381
  return to_ret;
370
- }).join('\n');
382
+ }).join('\n') + '\n';
371
383
  },
372
384
 
373
385
  // TypeScript declarations
@@ -407,11 +419,12 @@ module.exports = {
407
419
  'typescript/es6-declarations': function({dictionary, file, options}) {
408
420
  return fileHeader({file}) +
409
421
  dictionary.allProperties.map(function(prop) {
410
- var to_ret_prop = 'export const ' + prop.name + ' : ' + getTypeScriptType(prop.value, options) + ';';
422
+ let to_ret_prop = '';
411
423
  if (prop.comment)
412
- to_ret_prop = to_ret_prop.concat(' // ' + prop.comment);
424
+ to_ret_prop += '/** ' + prop.comment + ' */\n';
425
+ to_ret_prop += 'export const ' + prop.name + ' : ' + getTypeScriptType(prop.value, options) + ';';
413
426
  return to_ret_prop;
414
- }).join('\n');
427
+ }).join('\n') + '\n';
415
428
  },
416
429
 
417
430
  /**
@@ -504,7 +517,7 @@ declare const ${moduleName}: ${JSON.stringify(treeWalker(dictionary.tokens), nul
504
517
 
505
518
  // JSON stringify will quote strings, because this is a type we need
506
519
  // it unquoted.
507
- return output.replace(/"DesignToken"/g,'DesignToken');
520
+ return output.replace(/"DesignToken"/g, 'DesignToken') + '\n';
508
521
  },
509
522
 
510
523
  // Android templates
@@ -708,7 +721,7 @@ declare const ${moduleName}: ${JSON.stringify(treeWalker(dictionary.tokens), nul
708
721
  * @param {String} className The name of the generated Kotlin object
709
722
  * @param {String} packageName The package for the generated Kotlin object
710
723
  * @param {Object} options
711
- * * @param {String[]} [options.import=androidx.compose.ui.unit.*] - Modules to import. Can be a string or array of string
724
+ * @param {String[]} [options.import=['androidx.compose.ui.graphics.Color', 'androidx.compose.ui.unit.*']] - Modules to import. Can be a string or array of strings
712
725
  * @param {Boolean} [options.showFileHeader=true] - Whether or not to include a comment that has the build date
713
726
  * @param {Boolean} [options.outputReferences=false] - Whether or not to keep [references](/#/formats?id=references-in-output-files) (a -> b -> c) in the output.
714
727
  * @example
@@ -914,7 +927,8 @@ declare const ${moduleName}: ${JSON.stringify(treeWalker(dictionary.tokens), nul
914
927
  * @kind member
915
928
  * @param {Object} options
916
929
  * @param {String} [options.accessControl=public] - Level of [access](https://docs.swift.org/swift-book/LanguageGuide/AccessControl.html) of the generated swift object
917
- * @param {String[]} [options.import=UIKit] - Modules to import. Can be a string or array of string
930
+ * @param {String[]} [options.import=UIKit] - Modules to import. Can be a string or array of strings
931
+ * @param {String} [options.className] - The name of the generated Swift class
918
932
  * @param {Boolean} [options.showFileHeader=true] - Whether or not to include a comment that has the build date
919
933
  * @param {Boolean} [options.outputReferences=false] - Whether or not to keep [references](/#/formats?id=references-in-output-files) (a -> b -> c) in the output.
920
934
  * @example
@@ -955,7 +969,7 @@ declare const ${moduleName}: ${JSON.stringify(treeWalker(dictionary.tokens), nul
955
969
  * @kind member
956
970
  * @param {Object} options
957
971
  * @param {String} [options.accessControl=public] - Level of [access](https://docs.swift.org/swift-book/LanguageGuide/AccessControl.html) of the generated swift object
958
- * @param {String[]} [options.import=UIKit] - Modules to import. Can be a string or array of string
972
+ * @param {String[]} [options.import=UIKit] - Modules to import. Can be a string or array of strings
959
973
  * @param {Boolean} [options.showFileHeader=true] - Whether or not to include a comment that has the build date
960
974
  * @param {Boolean} [options.outputReferences=false] - Whether or not to keep [references](/#/formats?id=references-in-output-files) (a -> b -> c) in the output.
961
975
  * @example
@@ -1073,7 +1087,7 @@ declare const ${moduleName}: ${JSON.stringify(treeWalker(dictionary.tokens), nul
1073
1087
  * ```
1074
1088
  */
1075
1089
  'json': function({dictionary}) {
1076
- return JSON.stringify(dictionary.tokens, null, 2);
1090
+ return JSON.stringify(dictionary.tokens, null, 2) + '\n';
1077
1091
  },
1078
1092
 
1079
1093
  /**
@@ -1115,7 +1129,7 @@ declare const ${moduleName}: ${JSON.stringify(treeWalker(dictionary.tokens), nul
1115
1129
  * ```
1116
1130
  */
1117
1131
  'json/nested': function({dictionary}) {
1118
- return JSON.stringify(minifyDictionary(dictionary.tokens), null, 2);
1132
+ return JSON.stringify(minifyDictionary(dictionary.tokens), null, 2) + '\n';
1119
1133
  },
1120
1134
 
1121
1135
  /**
@@ -1133,7 +1147,7 @@ declare const ${moduleName}: ${JSON.stringify(treeWalker(dictionary.tokens), nul
1133
1147
  'json/flat': function({dictionary}) {
1134
1148
  return '{\n' + dictionary.allTokens.map(function(token) {
1135
1149
  return ` "${token.name}": ${JSON.stringify(token.value)}`;
1136
- }).join(',\n') + '\n}';
1150
+ }).join(',\n') + '\n}' + '\n';
1137
1151
  },
1138
1152
 
1139
1153
  /**
@@ -1166,7 +1180,7 @@ declare const ${moduleName}: ${JSON.stringify(treeWalker(dictionary.tokens), nul
1166
1180
  .map(function(token) {
1167
1181
  return token.value;
1168
1182
  });
1169
- return JSON.stringify(to_ret, null, 2);
1183
+ return JSON.stringify(to_ret, null, 2) + '\n';
1170
1184
  },
1171
1185
 
1172
1186
  /**
@@ -1200,7 +1214,7 @@ declare const ${moduleName}: ${JSON.stringify(treeWalker(dictionary.tokens), nul
1200
1214
  }, token.value)
1201
1215
  })
1202
1216
  };
1203
- return JSON.stringify(to_ret, null, 2);
1217
+ return JSON.stringify(to_ret, null, 2) + '\n';
1204
1218
  },
1205
1219
 
1206
1220
 
@@ -23,4 +23,4 @@ class <%= file.className %> {
23
23
  <%= allTokens.map(function(prop) {
24
24
  return 'static const ' + formatProperty(prop);
25
25
  }).join('\n ') %>
26
- }
26
+ }
@@ -412,7 +412,7 @@ module.exports = {
412
412
  * Transforms the value into a Color class for Compose
413
413
  *
414
414
  * ```kotlin
415
- * // Matches: prop.attributes.category === 'color'
415
+ * // Matches: token.attributes.category === 'color'
416
416
  * // Returns:
417
417
  * Color(0xFF009688)
418
418
  * ```
@@ -422,8 +422,8 @@ module.exports = {
422
422
  'color/composeColor': {
423
423
  type: 'value',
424
424
  matcher: isColor,
425
- transformer: function (prop) {
426
- var str = Color(prop.value).toHex8();
425
+ transformer: function (token) {
426
+ var str = Color(token.value).toHex8();
427
427
  return 'Color(0x' + str.slice(6) + str.slice(0,6) + ')'
428
428
  }
429
429
  },
@@ -742,7 +742,7 @@ module.exports = {
742
742
  * Transforms the value from a REM size on web into a scale-independent pixel (sp) value for font sizes in Compose. It WILL scale the number by a factor of 16 (or the value of 'basePxFontSize' on the platform in your config).
743
743
  *
744
744
  * ```kotlin
745
- * // Matches: prop.attributes.category === 'size' && prop.attributes.type === 'font'
745
+ * // Matches: token.attributes.category === 'size' && token.attributes.type === 'font'
746
746
  * // Returns:
747
747
  * "16.0.sp"
748
748
  * ```
@@ -752,10 +752,10 @@ module.exports = {
752
752
  'size/compose/remToSp': {
753
753
  type: 'value',
754
754
  matcher: isFontSize,
755
- transformer: function(prop, options) {
756
- const val = parseFloat(prop.value);
755
+ transformer: function(token, options) {
756
+ const val = parseFloat(token.value);
757
757
  const baseFont = getBasePxFontSize(options);
758
- if (isNaN(val)) throwSizeError(prop.name, prop.value, 'sp');
758
+ if (isNaN(val)) throwSizeError(token.name, token.value, 'sp');
759
759
  return (val * baseFont).toFixed(2) + '.sp';
760
760
  }
761
761
  },
@@ -765,7 +765,7 @@ module.exports = {
765
765
  * Transforms the value from a REM size on web into a density-independent pixel (dp) value for font sizes in Compose. It WILL scale the number by a factor of 16 (or the value of 'basePxFontSize' on the platform in your config).
766
766
  *
767
767
  * ```kotlin
768
- * // Matches: prop.attributes.category === 'size' && prop.attributes.type !== 'font'
768
+ * // Matches: token.attributes.category === 'size' && token.attributes.type !== 'font'
769
769
  * // Returns:
770
770
  * "16.0.dp"
771
771
  * ```
@@ -775,10 +775,10 @@ module.exports = {
775
775
  'size/compose/remToDp': {
776
776
  type: 'value',
777
777
  matcher: isNotFontSize,
778
- transformer: function(prop, options) {
779
- const val = parseFloat(prop.value);
778
+ transformer: function(token, options) {
779
+ const val = parseFloat(token.value);
780
780
  const baseFont = getBasePxFontSize(options);
781
- if (isNaN(val)) throwSizeError(prop.name, prop.value, 'dp');
781
+ if (isNaN(val)) throwSizeError(token.name, token.value, 'dp');
782
782
  return (val * baseFont).toFixed(2) + '.dp';
783
783
  }
784
784
  },
@@ -787,7 +787,7 @@ module.exports = {
787
787
  * Adds the .em Compose extension to the end of a number. Does not scale the value
788
788
  *
789
789
  * ```kotlin
790
- * // Matches: prop.attributes.category === 'size' && prop.attributes.type === 'font'
790
+ * // Matches: token.attributes.category === 'size' && token.attributes.type === 'font'
791
791
  * // Returns:
792
792
  * "16.0em"
793
793
  * ```
@@ -797,9 +797,9 @@ module.exports = {
797
797
  'size/compose/em': {
798
798
  type: 'value',
799
799
  matcher: isFontSize,
800
- transformer: function(prop) {
801
- const val = parseFloat(prop.value);
802
- if (isNaN(val)) throwSizeError(prop.name, prop.value, 'em');
800
+ transformer: function(token) {
801
+ const val = parseFloat(token.value);
802
+ if (isNaN(val)) throwSizeError(token.name, token.value, 'em');
803
803
  return val + '.em';
804
804
  }
805
805
  },
@@ -46,15 +46,15 @@
46
46
  * });
47
47
  * ```
48
48
  */
49
- function registerAction(options) {
50
- if (typeof options.name !== 'string')
49
+ function registerAction(action) {
50
+ if (typeof action.name !== 'string')
51
51
  throw new Error('name must be a string');
52
- if (typeof options.do !== 'function')
52
+ if (typeof action.do !== 'function')
53
53
  throw new Error('do must be a function');
54
54
 
55
- this.action[options.name] = {
56
- do: options.do,
57
- undo: options.undo
55
+ this.action[action.name] = {
56
+ do: action.do,
57
+ undo: action.undo
58
58
  };
59
59
 
60
60
  return this;
@@ -29,13 +29,13 @@
29
29
  * })
30
30
  * ```
31
31
  */
32
- function registerFilter(options) {
33
- if (typeof options.name !== 'string')
32
+ function registerFilter(filter) {
33
+ if (typeof filter.name !== 'string')
34
34
  throw new Error('Can\'t register filter; filter.name must be a string');
35
- if (typeof options.matcher !== 'function')
35
+ if (typeof filter.matcher !== 'function')
36
36
  throw new Error('Can\'t register filter; filter.matcher must be a function');
37
37
 
38
- this.filter[options.name] = options.matcher;
38
+ this.filter[filter.name] = filter.matcher;
39
39
 
40
40
  return this;
41
41
  }
@@ -60,13 +60,13 @@
60
60
  * })
61
61
  * ```
62
62
  */
63
- function registerFormat(options) {
64
- if (typeof options.name !== 'string')
63
+ function registerFormat(format) {
64
+ if (typeof format.name !== 'string')
65
65
  throw new Error('Can\'t register format; format.name must be a string');
66
- if (typeof options.formatter !== 'function')
66
+ if (typeof format.formatter !== 'function')
67
67
  throw new Error('Can\'t register format; format.formatter must be a function');
68
68
 
69
- this.format[options.name] = options.formatter;
69
+ this.format[format.name] = format.formatter;
70
70
 
71
71
  return this;
72
72
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "style-dictionary",
3
- "version": "3.7.3-rc.1",
3
+ "version": "3.8.0",
4
4
  "description": "Style once, use everywhere. A build system for creating cross-platform styles.",
5
5
  "keywords": [
6
6
  "style dictionary",