@carbon/feature-flags 0.4.0 → 0.6.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 (3) hide show
  1. package/es/index.js +262 -87
  2. package/lib/index.js +262 -87
  3. package/package.json +14 -5
package/es/index.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- const enabled$1 = {};
8
+ var enabled$1 = {};
9
9
 
10
10
  try {
11
11
  if (process.env.CARBON_ENABLE_CSS_CUSTOM_PROPERTIES) {
@@ -54,7 +54,7 @@ try {
54
54
  enabled$1.enableV11Release = false;
55
55
  }
56
56
 
57
- const featureFlagInfo = [{
57
+ var featureFlagInfo = [{
58
58
  name: "enable-css-custom-properties",
59
59
  description: "Describe what the flag does",
60
60
  enabled: enabled$1.enableCssCustomProperties
@@ -72,122 +72,297 @@ const featureFlagInfo = [{
72
72
  enabled: enabled$1.enableV11Release
73
73
  }];
74
74
 
75
- class FeatureFlagScope {
76
- constructor(flags) {
75
+ function _classCallCheck(instance, Constructor) {
76
+ if (!(instance instanceof Constructor)) {
77
+ throw new TypeError("Cannot call a class as a function");
78
+ }
79
+ }
80
+
81
+ function _defineProperties(target, props) {
82
+ for (var i = 0; i < props.length; i++) {
83
+ var descriptor = props[i];
84
+ descriptor.enumerable = descriptor.enumerable || false;
85
+ descriptor.configurable = true;
86
+ if ("value" in descriptor) descriptor.writable = true;
87
+ Object.defineProperty(target, descriptor.key, descriptor);
88
+ }
89
+ }
90
+
91
+ function _createClass(Constructor, protoProps, staticProps) {
92
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
93
+ if (staticProps) _defineProperties(Constructor, staticProps);
94
+ return Constructor;
95
+ }
96
+
97
+ function _slicedToArray(arr, i) {
98
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
99
+ }
100
+
101
+ function _arrayWithHoles(arr) {
102
+ if (Array.isArray(arr)) return arr;
103
+ }
104
+
105
+ function _iterableToArrayLimit(arr, i) {
106
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
107
+
108
+ if (_i == null) return;
109
+ var _arr = [];
110
+ var _n = true;
111
+ var _d = false;
112
+
113
+ var _s, _e;
114
+
115
+ try {
116
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
117
+ _arr.push(_s.value);
118
+
119
+ if (i && _arr.length === i) break;
120
+ }
121
+ } catch (err) {
122
+ _d = true;
123
+ _e = err;
124
+ } finally {
125
+ try {
126
+ if (!_n && _i["return"] != null) _i["return"]();
127
+ } finally {
128
+ if (_d) throw _e;
129
+ }
130
+ }
131
+
132
+ return _arr;
133
+ }
134
+
135
+ function _unsupportedIterableToArray(o, minLen) {
136
+ if (!o) return;
137
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
138
+ var n = Object.prototype.toString.call(o).slice(8, -1);
139
+ if (n === "Object" && o.constructor) n = o.constructor.name;
140
+ if (n === "Map" || n === "Set") return Array.from(o);
141
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
142
+ }
143
+
144
+ function _arrayLikeToArray(arr, len) {
145
+ if (len == null || len > arr.length) len = arr.length;
146
+
147
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
148
+
149
+ return arr2;
150
+ }
151
+
152
+ function _nonIterableRest() {
153
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
154
+ }
155
+
156
+ function _createForOfIteratorHelper(o, allowArrayLike) {
157
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
158
+
159
+ if (!it) {
160
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
161
+ if (it) o = it;
162
+ var i = 0;
163
+
164
+ var F = function () {};
165
+
166
+ return {
167
+ s: F,
168
+ n: function () {
169
+ if (i >= o.length) return {
170
+ done: true
171
+ };
172
+ return {
173
+ done: false,
174
+ value: o[i++]
175
+ };
176
+ },
177
+ e: function (e) {
178
+ throw e;
179
+ },
180
+ f: F
181
+ };
182
+ }
183
+
184
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
185
+ }
186
+
187
+ var normalCompletion = true,
188
+ didErr = false,
189
+ err;
190
+ return {
191
+ s: function () {
192
+ it = it.call(o);
193
+ },
194
+ n: function () {
195
+ var step = it.next();
196
+ normalCompletion = step.done;
197
+ return step;
198
+ },
199
+ e: function (e) {
200
+ didErr = true;
201
+ err = e;
202
+ },
203
+ f: function () {
204
+ try {
205
+ if (!normalCompletion && it.return != null) it.return();
206
+ } finally {
207
+ if (didErr) throw err;
208
+ }
209
+ }
210
+ };
211
+ }
212
+
213
+ /**
214
+ * Copyright IBM Corp. 2015, 2020
215
+ *
216
+ * This source code is licensed under the Apache-2.0 license found in the
217
+ * LICENSE file in the root directory of this source tree.
218
+ */
219
+ var FeatureFlagScope = /*#__PURE__*/function () {
220
+ function FeatureFlagScope(flags) {
221
+ var _this = this;
222
+
223
+ _classCallCheck(this, FeatureFlagScope);
224
+
77
225
  this.flags = new Map();
78
226
 
79
227
  if (flags) {
80
- Object.keys(flags).forEach((key) => {
81
- this.flags.set(key, flags[key]);
228
+ Object.keys(flags).forEach(function (key) {
229
+ _this.flags.set(key, flags[key]);
82
230
  });
83
231
  }
84
232
  }
85
-
86
233
  /**
87
234
  * Check to see if a flag exists
88
235
  * @param {string} name
89
236
  */
90
- checkForFlag(name) {
91
- if (!this.flags.has(name)) {
92
- throw new Error(
93
- `Unable to find a feature flag with the name: \`${name}\``
94
- );
237
+
238
+
239
+ _createClass(FeatureFlagScope, [{
240
+ key: "checkForFlag",
241
+ value: function checkForFlag(name) {
242
+ if (!this.flags.has(name)) {
243
+ throw new Error("Unable to find a feature flag with the name: `".concat(name, "`"));
244
+ }
95
245
  }
96
- }
246
+ /**
247
+ * Add a feature flag
248
+ * @param {string} name
249
+ * @param {boolean} enabled
250
+ */
97
251
 
98
- /**
99
- * Add a feature flag
100
- * @param {string} name
101
- * @param {boolean} enabled
102
- */
103
- add(name, enabled) {
104
- if (this.flags.has(name)) {
105
- throw new Error(`The feature flag: ${name} already exists`);
252
+ }, {
253
+ key: "add",
254
+ value: function add(name, enabled) {
255
+ if (this.flags.has(name)) {
256
+ throw new Error("The feature flag: ".concat(name, " already exists"));
257
+ }
258
+
259
+ this.flags.set(name, enabled);
106
260
  }
107
- this.flags.set(name, enabled);
108
- }
261
+ /**
262
+ * Enable a feature flag
263
+ * @param {string} name
264
+ */
109
265
 
110
- /**
111
- * Enable a feature flag
112
- * @param {string} name
113
- */
114
- enable(name) {
115
- this.checkForFlag(name);
116
- this.flags.set(name, true);
117
- }
266
+ }, {
267
+ key: "enable",
268
+ value: function enable(name) {
269
+ this.checkForFlag(name);
270
+ this.flags.set(name, true);
271
+ }
272
+ /**
273
+ * Disable a feature flag
274
+ * @param {string} name
275
+ */
118
276
 
119
- /**
120
- * Disable a feature flag
121
- * @param {string} name
122
- */
123
- disable(name) {
124
- this.checkForFlag(name);
125
- this.flags.set(name, false);
126
- }
277
+ }, {
278
+ key: "disable",
279
+ value: function disable(name) {
280
+ this.checkForFlag(name);
281
+ this.flags.set(name, false);
282
+ }
283
+ /**
284
+ * Merge the given feature flags with the current set of feature flags.
285
+ * Duplicate keys will be set to the value in the given feature flags.
286
+ * @param {object} flags
287
+ */
127
288
 
128
- /**
129
- * Merge the given feature flags with the current set of feature flags.
130
- * Duplicate keys will be set to the value in the given feature flags.
131
- * @param {object} flags
132
- */
133
- merge(flags) {
134
- Object.keys(flags).forEach((key) => {
135
- this.flags.set(key, flags[key]);
136
- });
137
- }
289
+ }, {
290
+ key: "merge",
291
+ value: function merge(flags) {
292
+ var _this2 = this;
138
293
 
139
- /**
140
- * @param {FeatureFlagScope} scope
141
- */
142
- mergeWithScope(scope) {
143
- for (const [key, value] of scope.flags) {
144
- if (this.flags.has(key)) {
145
- continue;
294
+ Object.keys(flags).forEach(function (key) {
295
+ _this2.flags.set(key, flags[key]);
296
+ });
297
+ }
298
+ /**
299
+ * @param {FeatureFlagScope} scope
300
+ */
301
+
302
+ }, {
303
+ key: "mergeWithScope",
304
+ value: function mergeWithScope(scope) {
305
+ var _iterator = _createForOfIteratorHelper(scope.flags),
306
+ _step;
307
+
308
+ try {
309
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
310
+ var _step$value = _slicedToArray(_step.value, 2),
311
+ key = _step$value[0],
312
+ value = _step$value[1];
313
+
314
+ if (this.flags.has(key)) {
315
+ continue;
316
+ }
317
+
318
+ this.flags.set(key, value);
319
+ }
320
+ } catch (err) {
321
+ _iterator.e(err);
322
+ } finally {
323
+ _iterator.f();
146
324
  }
147
- this.flags.set(key, value);
148
325
  }
149
- }
326
+ /**
327
+ * Check if a feature flag is enabled
328
+ * @param {string} name
329
+ * @returns {boolean}
330
+ */
150
331
 
151
- /**
152
- * Check if a feature flag is enabled
153
- * @param {string} name
154
- * @returns {boolean}
155
- */
156
- enabled(name) {
157
- this.checkForFlag(name);
158
- return this.flags.get(name);
159
- }
160
- }
332
+ }, {
333
+ key: "enabled",
334
+ value: function enabled(name) {
335
+ this.checkForFlag(name);
336
+ return this.flags.get(name);
337
+ }
338
+ }]);
339
+
340
+ return FeatureFlagScope;
341
+ }();
161
342
 
162
- const FeatureFlags = createScope();
343
+ var FeatureFlags = createScope();
163
344
 
164
- for (let i = 0; i < featureFlagInfo.length; i++) {
165
- const featureFlag = featureFlagInfo[i];
345
+ for (var i = 0; i < featureFlagInfo.length; i++) {
346
+ var featureFlag = featureFlagInfo[i];
166
347
  FeatureFlags.add(featureFlag.name, featureFlag.enabled);
167
348
  }
168
-
169
349
  function createScope(flags) {
170
350
  return new FeatureFlagScope(flags);
171
351
  }
172
-
173
- function add(...args) {
174
- return FeatureFlags.add(...args);
352
+ function add() {
353
+ return FeatureFlags.add.apply(FeatureFlags, arguments);
175
354
  }
176
-
177
- function enable(...args) {
178
- return FeatureFlags.enable(...args);
355
+ function enable() {
356
+ return FeatureFlags.enable.apply(FeatureFlags, arguments);
179
357
  }
180
-
181
- function disable(...args) {
182
- return FeatureFlags.disable(...args);
358
+ function disable() {
359
+ return FeatureFlags.disable.apply(FeatureFlags, arguments);
183
360
  }
184
-
185
- function enabled(...args) {
186
- return FeatureFlags.enabled(...args);
361
+ function enabled() {
362
+ return FeatureFlags.enabled.apply(FeatureFlags, arguments);
187
363
  }
188
-
189
- function merge(...args) {
190
- return FeatureFlags.merge(...args);
364
+ function merge() {
365
+ return FeatureFlags.merge.apply(FeatureFlags, arguments);
191
366
  }
192
367
 
193
368
  export { FeatureFlags, add, createScope, disable, enable, enabled, merge };
package/lib/index.js CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  Object.defineProperty(exports, '__esModule', { value: true });
11
11
 
12
- const enabled$1 = {};
12
+ var enabled$1 = {};
13
13
 
14
14
  try {
15
15
  if (process.env.CARBON_ENABLE_CSS_CUSTOM_PROPERTIES) {
@@ -58,7 +58,7 @@ try {
58
58
  enabled$1.enableV11Release = false;
59
59
  }
60
60
 
61
- const featureFlagInfo = [{
61
+ var featureFlagInfo = [{
62
62
  name: "enable-css-custom-properties",
63
63
  description: "Describe what the flag does",
64
64
  enabled: enabled$1.enableCssCustomProperties
@@ -76,122 +76,297 @@ const featureFlagInfo = [{
76
76
  enabled: enabled$1.enableV11Release
77
77
  }];
78
78
 
79
- class FeatureFlagScope {
80
- constructor(flags) {
79
+ function _classCallCheck(instance, Constructor) {
80
+ if (!(instance instanceof Constructor)) {
81
+ throw new TypeError("Cannot call a class as a function");
82
+ }
83
+ }
84
+
85
+ function _defineProperties(target, props) {
86
+ for (var i = 0; i < props.length; i++) {
87
+ var descriptor = props[i];
88
+ descriptor.enumerable = descriptor.enumerable || false;
89
+ descriptor.configurable = true;
90
+ if ("value" in descriptor) descriptor.writable = true;
91
+ Object.defineProperty(target, descriptor.key, descriptor);
92
+ }
93
+ }
94
+
95
+ function _createClass(Constructor, protoProps, staticProps) {
96
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
97
+ if (staticProps) _defineProperties(Constructor, staticProps);
98
+ return Constructor;
99
+ }
100
+
101
+ function _slicedToArray(arr, i) {
102
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
103
+ }
104
+
105
+ function _arrayWithHoles(arr) {
106
+ if (Array.isArray(arr)) return arr;
107
+ }
108
+
109
+ function _iterableToArrayLimit(arr, i) {
110
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
111
+
112
+ if (_i == null) return;
113
+ var _arr = [];
114
+ var _n = true;
115
+ var _d = false;
116
+
117
+ var _s, _e;
118
+
119
+ try {
120
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
121
+ _arr.push(_s.value);
122
+
123
+ if (i && _arr.length === i) break;
124
+ }
125
+ } catch (err) {
126
+ _d = true;
127
+ _e = err;
128
+ } finally {
129
+ try {
130
+ if (!_n && _i["return"] != null) _i["return"]();
131
+ } finally {
132
+ if (_d) throw _e;
133
+ }
134
+ }
135
+
136
+ return _arr;
137
+ }
138
+
139
+ function _unsupportedIterableToArray(o, minLen) {
140
+ if (!o) return;
141
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
142
+ var n = Object.prototype.toString.call(o).slice(8, -1);
143
+ if (n === "Object" && o.constructor) n = o.constructor.name;
144
+ if (n === "Map" || n === "Set") return Array.from(o);
145
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
146
+ }
147
+
148
+ function _arrayLikeToArray(arr, len) {
149
+ if (len == null || len > arr.length) len = arr.length;
150
+
151
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
152
+
153
+ return arr2;
154
+ }
155
+
156
+ function _nonIterableRest() {
157
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
158
+ }
159
+
160
+ function _createForOfIteratorHelper(o, allowArrayLike) {
161
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
162
+
163
+ if (!it) {
164
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
165
+ if (it) o = it;
166
+ var i = 0;
167
+
168
+ var F = function () {};
169
+
170
+ return {
171
+ s: F,
172
+ n: function () {
173
+ if (i >= o.length) return {
174
+ done: true
175
+ };
176
+ return {
177
+ done: false,
178
+ value: o[i++]
179
+ };
180
+ },
181
+ e: function (e) {
182
+ throw e;
183
+ },
184
+ f: F
185
+ };
186
+ }
187
+
188
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
189
+ }
190
+
191
+ var normalCompletion = true,
192
+ didErr = false,
193
+ err;
194
+ return {
195
+ s: function () {
196
+ it = it.call(o);
197
+ },
198
+ n: function () {
199
+ var step = it.next();
200
+ normalCompletion = step.done;
201
+ return step;
202
+ },
203
+ e: function (e) {
204
+ didErr = true;
205
+ err = e;
206
+ },
207
+ f: function () {
208
+ try {
209
+ if (!normalCompletion && it.return != null) it.return();
210
+ } finally {
211
+ if (didErr) throw err;
212
+ }
213
+ }
214
+ };
215
+ }
216
+
217
+ /**
218
+ * Copyright IBM Corp. 2015, 2020
219
+ *
220
+ * This source code is licensed under the Apache-2.0 license found in the
221
+ * LICENSE file in the root directory of this source tree.
222
+ */
223
+ var FeatureFlagScope = /*#__PURE__*/function () {
224
+ function FeatureFlagScope(flags) {
225
+ var _this = this;
226
+
227
+ _classCallCheck(this, FeatureFlagScope);
228
+
81
229
  this.flags = new Map();
82
230
 
83
231
  if (flags) {
84
- Object.keys(flags).forEach((key) => {
85
- this.flags.set(key, flags[key]);
232
+ Object.keys(flags).forEach(function (key) {
233
+ _this.flags.set(key, flags[key]);
86
234
  });
87
235
  }
88
236
  }
89
-
90
237
  /**
91
238
  * Check to see if a flag exists
92
239
  * @param {string} name
93
240
  */
94
- checkForFlag(name) {
95
- if (!this.flags.has(name)) {
96
- throw new Error(
97
- `Unable to find a feature flag with the name: \`${name}\``
98
- );
241
+
242
+
243
+ _createClass(FeatureFlagScope, [{
244
+ key: "checkForFlag",
245
+ value: function checkForFlag(name) {
246
+ if (!this.flags.has(name)) {
247
+ throw new Error("Unable to find a feature flag with the name: `".concat(name, "`"));
248
+ }
99
249
  }
100
- }
250
+ /**
251
+ * Add a feature flag
252
+ * @param {string} name
253
+ * @param {boolean} enabled
254
+ */
101
255
 
102
- /**
103
- * Add a feature flag
104
- * @param {string} name
105
- * @param {boolean} enabled
106
- */
107
- add(name, enabled) {
108
- if (this.flags.has(name)) {
109
- throw new Error(`The feature flag: ${name} already exists`);
256
+ }, {
257
+ key: "add",
258
+ value: function add(name, enabled) {
259
+ if (this.flags.has(name)) {
260
+ throw new Error("The feature flag: ".concat(name, " already exists"));
261
+ }
262
+
263
+ this.flags.set(name, enabled);
110
264
  }
111
- this.flags.set(name, enabled);
112
- }
265
+ /**
266
+ * Enable a feature flag
267
+ * @param {string} name
268
+ */
113
269
 
114
- /**
115
- * Enable a feature flag
116
- * @param {string} name
117
- */
118
- enable(name) {
119
- this.checkForFlag(name);
120
- this.flags.set(name, true);
121
- }
270
+ }, {
271
+ key: "enable",
272
+ value: function enable(name) {
273
+ this.checkForFlag(name);
274
+ this.flags.set(name, true);
275
+ }
276
+ /**
277
+ * Disable a feature flag
278
+ * @param {string} name
279
+ */
122
280
 
123
- /**
124
- * Disable a feature flag
125
- * @param {string} name
126
- */
127
- disable(name) {
128
- this.checkForFlag(name);
129
- this.flags.set(name, false);
130
- }
281
+ }, {
282
+ key: "disable",
283
+ value: function disable(name) {
284
+ this.checkForFlag(name);
285
+ this.flags.set(name, false);
286
+ }
287
+ /**
288
+ * Merge the given feature flags with the current set of feature flags.
289
+ * Duplicate keys will be set to the value in the given feature flags.
290
+ * @param {object} flags
291
+ */
131
292
 
132
- /**
133
- * Merge the given feature flags with the current set of feature flags.
134
- * Duplicate keys will be set to the value in the given feature flags.
135
- * @param {object} flags
136
- */
137
- merge(flags) {
138
- Object.keys(flags).forEach((key) => {
139
- this.flags.set(key, flags[key]);
140
- });
141
- }
293
+ }, {
294
+ key: "merge",
295
+ value: function merge(flags) {
296
+ var _this2 = this;
142
297
 
143
- /**
144
- * @param {FeatureFlagScope} scope
145
- */
146
- mergeWithScope(scope) {
147
- for (const [key, value] of scope.flags) {
148
- if (this.flags.has(key)) {
149
- continue;
298
+ Object.keys(flags).forEach(function (key) {
299
+ _this2.flags.set(key, flags[key]);
300
+ });
301
+ }
302
+ /**
303
+ * @param {FeatureFlagScope} scope
304
+ */
305
+
306
+ }, {
307
+ key: "mergeWithScope",
308
+ value: function mergeWithScope(scope) {
309
+ var _iterator = _createForOfIteratorHelper(scope.flags),
310
+ _step;
311
+
312
+ try {
313
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
314
+ var _step$value = _slicedToArray(_step.value, 2),
315
+ key = _step$value[0],
316
+ value = _step$value[1];
317
+
318
+ if (this.flags.has(key)) {
319
+ continue;
320
+ }
321
+
322
+ this.flags.set(key, value);
323
+ }
324
+ } catch (err) {
325
+ _iterator.e(err);
326
+ } finally {
327
+ _iterator.f();
150
328
  }
151
- this.flags.set(key, value);
152
329
  }
153
- }
330
+ /**
331
+ * Check if a feature flag is enabled
332
+ * @param {string} name
333
+ * @returns {boolean}
334
+ */
154
335
 
155
- /**
156
- * Check if a feature flag is enabled
157
- * @param {string} name
158
- * @returns {boolean}
159
- */
160
- enabled(name) {
161
- this.checkForFlag(name);
162
- return this.flags.get(name);
163
- }
164
- }
336
+ }, {
337
+ key: "enabled",
338
+ value: function enabled(name) {
339
+ this.checkForFlag(name);
340
+ return this.flags.get(name);
341
+ }
342
+ }]);
343
+
344
+ return FeatureFlagScope;
345
+ }();
165
346
 
166
- const FeatureFlags = createScope();
347
+ var FeatureFlags = createScope();
167
348
 
168
- for (let i = 0; i < featureFlagInfo.length; i++) {
169
- const featureFlag = featureFlagInfo[i];
349
+ for (var i = 0; i < featureFlagInfo.length; i++) {
350
+ var featureFlag = featureFlagInfo[i];
170
351
  FeatureFlags.add(featureFlag.name, featureFlag.enabled);
171
352
  }
172
-
173
353
  function createScope(flags) {
174
354
  return new FeatureFlagScope(flags);
175
355
  }
176
-
177
- function add(...args) {
178
- return FeatureFlags.add(...args);
356
+ function add() {
357
+ return FeatureFlags.add.apply(FeatureFlags, arguments);
179
358
  }
180
-
181
- function enable(...args) {
182
- return FeatureFlags.enable(...args);
359
+ function enable() {
360
+ return FeatureFlags.enable.apply(FeatureFlags, arguments);
183
361
  }
184
-
185
- function disable(...args) {
186
- return FeatureFlags.disable(...args);
362
+ function disable() {
363
+ return FeatureFlags.disable.apply(FeatureFlags, arguments);
187
364
  }
188
-
189
- function enabled(...args) {
190
- return FeatureFlags.enabled(...args);
365
+ function enabled() {
366
+ return FeatureFlags.enabled.apply(FeatureFlags, arguments);
191
367
  }
192
-
193
- function merge(...args) {
194
- return FeatureFlags.merge(...args);
368
+ function merge() {
369
+ return FeatureFlags.merge.apply(FeatureFlags, arguments);
195
370
  }
196
371
 
197
372
  exports.FeatureFlags = FeatureFlags;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/feature-flags",
3
3
  "description": "Build with feature flags in Carbon",
4
- "version": "0.4.0",
4
+ "version": "0.6.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -33,10 +33,14 @@
33
33
  "watch": "yarn clean && node tasks/build.js && rollup -c -w"
34
34
  },
35
35
  "devDependencies": {
36
- "@babel/generator": "^7.14.0",
37
- "@babel/template": "^7.12.13",
38
- "@babel/types": "^7.14.0",
36
+ "@babel/core": "^7.14.6",
37
+ "@babel/generator": "^7.14.5",
38
+ "@babel/preset-env": "^7.14.7",
39
+ "@babel/template": "^7.14.5",
40
+ "@babel/types": "^7.14.5",
39
41
  "@carbon/scss-generator": "^10.13.0",
42
+ "@rollup/plugin-babel": "^5.3.0",
43
+ "@rollup/plugin-node-resolve": "^13.0.0",
40
44
  "change-case": "^4.1.2",
41
45
  "fs-extra": "^9.0.1",
42
46
  "js-yaml": "^3.14.0",
@@ -45,5 +49,10 @@
45
49
  "rollup-plugin-strip-banner": "^2.0.0"
46
50
  },
47
51
  "sideEffects": false,
48
- "gitHead": "b00113e8d4cb273a80d9c71f12b741ae6ac360a6"
52
+ "babel": {
53
+ "presets": [
54
+ "@babel/env"
55
+ ]
56
+ },
57
+ "gitHead": "9c2eb1cfa0e5b2c4dc0142b98cd8828e84640af8"
49
58
  }