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