chordsheetjs 5.0.0 → 5.3.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 (34) hide show
  1. package/d7b54993c4ea66c07a35bd36690482ab620f836e.patch +105 -0
  2. package/lib/chord.js +118 -13
  3. package/lib/chord_sheet/chord_lyrics_pair.js +1 -1
  4. package/lib/chord_sheet/chord_pro/composite.js +1 -1
  5. package/lib/chord_sheet/chord_pro/evaluation_error.js +7 -3
  6. package/lib/chord_sheet/chord_pro/literal.js +1 -1
  7. package/lib/chord_sheet/chord_pro/ternary.js +1 -1
  8. package/lib/chord_sheet/comment.js +1 -1
  9. package/lib/chord_sheet/line.js +1 -1
  10. package/lib/chord_sheet/metadata.js +1 -1
  11. package/lib/chord_sheet/paragraph.js +1 -1
  12. package/lib/chord_sheet/song.js +9 -5
  13. package/lib/chord_sheet/tag.js +10 -3
  14. package/lib/chord_sheet_serializer.js +1 -1
  15. package/lib/constants.js +6 -2
  16. package/lib/formatter/chord_pro_formatter.js +1 -1
  17. package/lib/formatter/html_div_formatter.js +4 -4
  18. package/lib/formatter/html_formatter.js +3 -2
  19. package/lib/formatter/html_table_formatter.js +4 -4
  20. package/lib/formatter/templates/html_div_formatter.js +31 -32
  21. package/lib/formatter/templates/html_table_formatter.js +7 -6
  22. package/lib/formatter/text_formatter.js +25 -17
  23. package/lib/helpers.js +32 -0
  24. package/lib/index.js +1 -1
  25. package/lib/key.js +103 -32
  26. package/lib/note.js +154 -27
  27. package/lib/parser/chord_pro_parser.js +1 -1
  28. package/lib/parser/chord_pro_peg_parser.js +22 -13
  29. package/lib/parser/chord_sheet_parser.js +1 -1
  30. package/lib/parser/parser_warning.js +1 -1
  31. package/lib/parser/ultimate_guitar_parser.js +3 -3
  32. package/lib/{handlebars_helpers.js → template_helpers.js} +21 -2
  33. package/lib/utilities.js +3 -17
  34. package/package.json +5 -4
@@ -0,0 +1,105 @@
1
+ commit d7b54993c4ea66c07a35bd36690482ab620f836e
2
+ Author: Martijn Versluis <martijnversluis@users.noreply.github.com>
3
+ Date: Sun Jan 30 16:35:24 2022 +0100
4
+
5
+ Do not rely on contructor name
6
+
7
+ Due to build tools scrambling constructor names, we can not rely on those
8
+ for type checking. Thus we have to use `instanceof`. This change removes
9
+ usages of `constructor.name` and solves the cyclic dependency by moving around
10
+ some functions.
11
+
12
+ Resolves #421
13
+
14
+ diff --git a/src/formatter/html_div_formatter.js b/src/formatter/html_div_formatter.js
15
+ index f92f532..b1de230 100644
16
+ --- a/src/formatter/html_div_formatter.js
17
+ +++ b/src/formatter/html_div_formatter.js
18
+ @@ -1,6 +1,6 @@
19
+ import Handlebars from 'handlebars';
20
+
21
+ -import '../handlebars_helpers';
22
+ +import '../template_helpers';
23
+ import HtmlFormatter from './html_formatter';
24
+ import './templates/html_div_formatter';
25
+ import { scopeCss } from '../utilities';
26
+ diff --git a/src/formatter/html_table_formatter.js b/src/formatter/html_table_formatter.js
27
+ index 4883fef..7d7e8ea 100644
28
+ --- a/src/formatter/html_table_formatter.js
29
+ +++ b/src/formatter/html_table_formatter.js
30
+ @@ -1,6 +1,6 @@
31
+ import Handlebars from 'handlebars';
32
+
33
+ -import '../handlebars_helpers';
34
+ +import '../template_helpers';
35
+ import HtmlFormatter from './html_formatter';
36
+ import './templates/html_table_formatter';
37
+ import { scopeCss } from '../utilities';
38
+ diff --git a/src/formatter/text_formatter.js b/src/formatter/text_formatter.js
39
+ index 61385f1..81fe226 100644
40
+ --- a/src/formatter/text_formatter.js
41
+ +++ b/src/formatter/text_formatter.js
42
+ @@ -1,10 +1,10 @@
43
+ import ChordLyricsPair from '../chord_sheet/chord_lyrics_pair';
44
+ import Tag from '../chord_sheet/tag';
45
+ import { renderChord } from '../helpers';
46
+ +import { hasTextContents } from '../template_helpers';
47
+
48
+ import {
49
+ hasChordContents,
50
+ - hasTextContents,
51
+ padLeft,
52
+ } from '../utilities';
53
+
54
+ diff --git a/src/handlebars_helpers.js b/src/template_helpers.js
55
+ similarity index 87%
56
+ rename from src/handlebars_helpers.js
57
+ rename to src/template_helpers.js
58
+ index 0e5ff98..b330f87 100644
59
+ --- a/src/handlebars_helpers.js
60
+ +++ b/src/template_helpers.js
61
+ @@ -7,12 +7,20 @@ import { renderChord } from './helpers';
62
+
63
+ import {
64
+ hasChordContents,
65
+ - hasTextContents,
66
+ isEvaluatable,
67
+ } from './utilities';
68
+
69
+ const lineHasContents = (line) => line.items.some((item) => item.isRenderable());
70
+
71
+ +/* eslint import/prefer-default-export: 0 */
72
+ +export const hasTextContents = (line) => (
73
+ + line.items.some((item) => (
74
+ + (item instanceof ChordLyricsPair && item.lyrics)
75
+ + || (item instanceof Tag && item.isRenderable())
76
+ + || isEvaluatable(item)
77
+ + ))
78
+ +);
79
+ +
80
+ HandleBars.registerHelper('isChordLyricsPair', (item) => item instanceof ChordLyricsPair);
81
+
82
+ HandleBars.registerHelper('isTag', (item) => item instanceof Tag);
83
+ diff --git a/src/utilities.js b/src/utilities.js
84
+ index 03c69cc..503c811 100644
85
+ --- a/src/utilities.js
86
+ +++ b/src/utilities.js
87
+ @@ -8,18 +8,6 @@ export const hasChordContents = (line) => line.items.some((item) => !!item.chord
88
+
89
+ export const isEvaluatable = (item) => typeof item.evaluate === 'function';
90
+
91
+ -function isInstanceOf(object, constructorName) {
92
+ - return object?.constructor?.name === constructorName;
93
+ -}
94
+ -
95
+ -export const hasTextContents = (line) => (
96
+ - line.items.some((item) => (
97
+ - (isInstanceOf(item, 'ChordLyricsPair') && item.lyrics)
98
+ - || (isInstanceOf(item, 'Tag') && item.isRenderable())
99
+ - || isEvaluatable(item)
100
+ - ))
101
+ -);
102
+ -
103
+ export const padLeft = (str, length) => {
104
+ let paddedString = str;
105
+ for (let l = str.length; l < length; l += 1, paddedString += ' ');
package/lib/chord.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -16,9 +16,9 @@ var _constants = require("./constants");
16
16
 
17
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
18
18
 
19
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
19
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
20
20
 
21
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
21
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
22
22
 
23
23
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
24
24
 
@@ -26,7 +26,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
26
26
 
27
27
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
28
28
 
29
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
29
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
30
30
 
31
31
  function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
32
32
 
@@ -42,9 +42,21 @@ function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!priva
42
42
 
43
43
  function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
44
44
 
45
- function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(re, groups) { return new BabelRegExp(re, undefined, groups); }; var _super = RegExp.prototype; var _groups = new WeakMap(); function BabelRegExp(re, flags, groups) { var _this = new RegExp(re, flags); _groups.set(_this, groups || _groups.get(re)); return _setPrototypeOf(_this, BabelRegExp.prototype); } _inherits(BabelRegExp, RegExp); BabelRegExp.prototype.exec = function (str) { var result = _super.exec.call(this, str); if (result) result.groups = buildGroups(result, this); return result; }; BabelRegExp.prototype[Symbol.replace] = function (str, substitution) { if (typeof substitution === "string") { var groups = _groups.get(this); return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) { return "$" + groups[name]; })); } else if (typeof substitution === "function") { var _this = this; return _super[Symbol.replace].call(this, str, function () { var args = arguments; if (_typeof(args[args.length - 1]) !== "object") { args = [].slice.call(args); args.push(buildGroups(args, _this)); } return substitution.apply(this, args); }); } else { return _super[Symbol.replace].call(this, str, substitution); } }; function buildGroups(result, re) { var g = _groups.get(re); return Object.keys(g).reduce(function (groups, name) { groups[name] = result[g[name]]; return groups; }, Object.create(null)); } return _wrapRegExp.apply(this, arguments); }
45
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
46
46
 
47
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
47
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
48
+
49
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
50
+
51
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
52
+
53
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
54
+
55
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
56
+
57
+ function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(re, groups) { return new BabelRegExp(re, void 0, groups); }; var _super = RegExp.prototype, _groups = new WeakMap(); function BabelRegExp(re, flags, groups) { var _this = new RegExp(re, flags); return _groups.set(_this, groups || _groups.get(re)), _setPrototypeOf(_this, BabelRegExp.prototype); } function buildGroups(result, re) { var g = _groups.get(re); return Object.keys(g).reduce(function (groups, name) { return groups[name] = result[g[name]], groups; }, Object.create(null)); } return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (str) { var result = _super.exec.call(this, str); return result && (result.groups = buildGroups(result, this)), result; }, BabelRegExp.prototype[Symbol.replace] = function (str, substitution) { if ("string" == typeof substitution) { var groups = _groups.get(this); return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) { return "$" + groups[name]; })); } if ("function" == typeof substitution) { var _this = this; return _super[Symbol.replace].call(this, str, function () { var args = arguments; return "object" != _typeof(args[args.length - 1]) && (args = [].slice.call(args)).push(buildGroups(args, _this)), substitution.apply(this, args); }); } return _super[Symbol.replace].call(this, str, substitution); }, _wrapRegExp.apply(this, arguments); }
58
+
59
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
48
60
 
49
61
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
50
62
 
@@ -83,7 +95,16 @@ var numericChordRegex = /*#__PURE__*/_wrapRegExp(/^(#|b)?([1-7])((?:(?![\t-\r \/
83
95
  bassBase: 6
84
96
  });
85
97
 
86
- var regexes = [numericChordRegex, chordRegex];
98
+ var sortedNumerals = _toConsumableArray(_constants.ROMAN_NUMERALS).sort(function (numeralA, numeralB) {
99
+ return numeralB.length - numeralA.length;
100
+ });
101
+
102
+ var numerals = [].concat(_toConsumableArray(sortedNumerals), _toConsumableArray(sortedNumerals.map(function (numeral) {
103
+ return numeral.toLowerCase();
104
+ }))).join('|');
105
+ var numeralChordRegex = // eslint-disable-next-line max-len
106
+ new RegExp("^(?<modifier>#|b)?(?<base>".concat(numerals, ")(?<suffix>[^/\\s]*)(\\/(?<bassModifier>#|b)?(?<bassBase>").concat(numerals, "))?$"));
107
+ var regexes = [numericChordRegex, numeralChordRegex, chordRegex];
87
108
  /**
88
109
  * Represents a Chord, consisting of a root, suffix (quality) and bass
89
110
  */
@@ -162,11 +183,17 @@ var Chord = /*#__PURE__*/function () {
162
183
 
163
184
  var keyObj = _key["default"].wrap(key);
164
185
 
165
- return new Chord({
186
+ var chordSymbolChord = new Chord({
166
187
  suffix: chordSuffix(_classPrivateFieldGet(this, _rootNote), this.suffix),
167
188
  root: this.root.toChordSymbol(keyObj),
168
189
  bass: (_this$bass = this.bass) === null || _this$bass === void 0 ? void 0 : _this$bass.toChordSymbol(keyObj)
169
190
  });
191
+
192
+ if (this.root.isMinor()) {
193
+ chordSymbolChord = chordSymbolChord.makeMinor();
194
+ }
195
+
196
+ return chordSymbolChord;
170
197
  }
171
198
  /**
172
199
  * Converts the chord to a chord symbol string, using the supplied key as a reference.
@@ -193,7 +220,7 @@ var Chord = /*#__PURE__*/function () {
193
220
  return _classPrivateMethodGet(this, _is, _is2).call(this, _constants.SYMBOL);
194
221
  }
195
222
  /**
196
- * Converts the chord to a numeric chord, using the supplied kye as a reference.
223
+ * Converts the chord to a numeric chord, using the supplied key as a reference.
197
224
  * For example, a chord symbol A# with reference key E will return the numeric chord #4.
198
225
  * @param {Key|string} key the reference key
199
226
  * @returns {Chord} the numeric chord
@@ -202,20 +229,77 @@ var Chord = /*#__PURE__*/function () {
202
229
  }, {
203
230
  key: "toNumeric",
204
231
  value: function toNumeric(key) {
205
- var _this$bass2;
232
+ var _this$bass3;
206
233
 
207
234
  if (this.isNumeric()) {
208
235
  return this.clone();
209
236
  }
210
237
 
238
+ if (this.isNumeral()) {
239
+ var _this$bass2;
240
+
241
+ return this.set({
242
+ root: this.root.toNumeric(),
243
+ bass: (_this$bass2 = this.bass) === null || _this$bass2 === void 0 ? void 0 : _this$bass2.toNumeric()
244
+ });
245
+ }
246
+
211
247
  var keyObj = _key["default"].wrap(key);
212
248
 
213
249
  return new Chord({
214
250
  suffix: chordSuffix(_classPrivateFieldGet(this, _rootNote), this.suffix),
215
251
  root: this.root.toNumeric(keyObj),
216
- bass: (_this$bass2 = this.bass) === null || _this$bass2 === void 0 ? void 0 : _this$bass2.toNumeric(keyObj)
252
+ bass: (_this$bass3 = this.bass) === null || _this$bass3 === void 0 ? void 0 : _this$bass3.toNumeric(keyObj)
253
+ });
254
+ }
255
+ /**
256
+ * Converts the chord to a numeral chord, using the supplied key as a reference.
257
+ * For example, a chord symbol A# with reference key E will return the numeral chord #IV.
258
+ * @param {Key|string|null} key the reference key. The key is required when converting a chord symbol
259
+ * @returns {Chord} the numeral chord
260
+ */
261
+
262
+ }, {
263
+ key: "toNumeral",
264
+ value: function toNumeral() {
265
+ var _this$bass5;
266
+
267
+ var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
268
+
269
+ if (this.isNumeral()) {
270
+ return this.clone();
271
+ }
272
+
273
+ if (this.isNumeric()) {
274
+ var _this$bass4;
275
+
276
+ return this.set({
277
+ root: this.root.toNumeral(),
278
+ bass: (_this$bass4 = this.bass) === null || _this$bass4 === void 0 ? void 0 : _this$bass4.toNumeral()
279
+ });
280
+ }
281
+
282
+ var keyObj = _key["default"].wrap(key);
283
+
284
+ return new Chord({
285
+ suffix: chordSuffix(_classPrivateFieldGet(this, _rootNote), this.suffix),
286
+ root: this.root.toNumeral(keyObj),
287
+ bass: (_this$bass5 = this.bass) === null || _this$bass5 === void 0 ? void 0 : _this$bass5.toNumeral(keyObj)
217
288
  });
218
289
  }
290
+ /**
291
+ * Converts the chord to a numeral chord string, using the supplied kye as a reference.
292
+ * For example, a chord symbol A# with reference key E will return the numeral chord #4.
293
+ * @param {Key|string} key the reference key
294
+ * @returns {string} the numeral chord string
295
+ * @see {toNumeral}
296
+ */
297
+
298
+ }, {
299
+ key: "toNumeralString",
300
+ value: function toNumeralString(key) {
301
+ return this.toNumeral(key).toString();
302
+ }
219
303
  /**
220
304
  * Determines whether the chord is numeric
221
305
  * @returns {boolean}
@@ -239,6 +323,16 @@ var Chord = /*#__PURE__*/function () {
239
323
  value: function toNumericString(key) {
240
324
  return this.toNumeric(key).toString();
241
325
  }
326
+ /**
327
+ * Determines whether the chord is a numeral
328
+ * @returns {boolean}
329
+ */
330
+
331
+ }, {
332
+ key: "isNumeral",
333
+ value: function isNumeral() {
334
+ return _classPrivateMethodGet(this, _is, _is2).call(this, _constants.NUMERAL);
335
+ }
242
336
  /**
243
337
  * Converts the chord to a string, eg `Esus4/G#` or `1sus4/#3`
244
338
  * @returns {string} the chord string
@@ -317,15 +411,26 @@ var Chord = /*#__PURE__*/function () {
317
411
  value: function transpose(delta) {
318
412
  return _classPrivateMethodGet(this, _process, _process2).call(this, 'transpose', delta);
319
413
  }
414
+ }, {
415
+ key: "makeMinor",
416
+ value: function makeMinor() {
417
+ if (!this.suffix || this.suffix[0] !== 'm') {
418
+ return this.set({
419
+ suffix: "m".concat(this.suffix || '')
420
+ });
421
+ }
422
+
423
+ return this.clone();
424
+ }
320
425
  }, {
321
426
  key: "set",
322
427
  value: function set(properties) {
323
- var _this$bass3;
428
+ var _this$bass6;
324
429
 
325
430
  return new this.constructor(_objectSpread({
326
431
  root: this.root.clone(),
327
432
  suffix: this.suffix,
328
- bass: (_this$bass3 = this.bass) === null || _this$bass3 === void 0 ? void 0 : _this$bass3.clone()
433
+ bass: (_this$bass6 = this.bass) === null || _this$bass6 === void 0 ? void 0 : _this$bass6.clone()
329
434
  }, properties));
330
435
  }
331
436
  }], [{
@@ -9,7 +9,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
9
9
 
10
10
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
11
11
 
12
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
12
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
13
13
 
14
14
  /**
15
15
  * Represents a chord with the corresponding (partial) lyrics
@@ -9,7 +9,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
9
9
 
10
10
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
11
11
 
12
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
12
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
13
13
 
14
14
  var Composite = /*#__PURE__*/function () {
15
15
  function Composite(expressions) {
@@ -1,15 +1,19 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports["default"] = void 0;
9
9
 
10
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
11
+
12
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
13
+
10
14
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
11
15
 
12
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
16
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
13
17
 
14
18
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
15
19
 
@@ -47,7 +51,7 @@ var EvaluationError = /*#__PURE__*/function (_Error) {
47
51
  return _this;
48
52
  }
49
53
 
50
- return EvaluationError;
54
+ return _createClass(EvaluationError);
51
55
  }( /*#__PURE__*/_wrapNativeSuper(Error));
52
56
 
53
57
  var _default = EvaluationError;
@@ -9,7 +9,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
9
9
 
10
10
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
11
11
 
12
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
12
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
13
13
 
14
14
  var Literal = /*#__PURE__*/function () {
15
15
  function Literal(expression) {
@@ -17,7 +17,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
17
17
 
18
18
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
19
19
 
20
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
20
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
21
21
 
22
22
  var Ternary = /*#__PURE__*/function () {
23
23
  function Ternary() {
@@ -9,7 +9,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
9
9
 
10
10
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
11
11
 
12
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
12
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
13
13
 
14
14
  /**
15
15
  * Represents a comment. See https://www.chordpro.org/chordpro/chordpro-file-format-specification/#overview
@@ -19,7 +19,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
19
19
 
20
20
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
21
21
 
22
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
22
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
23
23
 
24
24
  /**
25
25
  * Represents a line in a chord sheet, consisting of items of type ChordLyricsPair or Tag
@@ -35,7 +35,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
35
35
 
36
36
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
37
37
 
38
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
38
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
39
39
 
40
40
  function appendValue(array, key, value) {
41
41
  if (!array.includes(value)) {
@@ -23,7 +23,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
23
23
 
24
24
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
25
25
 
26
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
26
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
27
27
 
28
28
  /**
29
29
  * Represents a paragraph of lines in a chord sheet
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -9,17 +9,17 @@ exports["default"] = void 0;
9
9
 
10
10
  var _line = _interopRequireDefault(require("./line"));
11
11
 
12
- var _tag = _interopRequireWildcard(require("./tag"));
13
-
14
12
  var _paragraph = _interopRequireDefault(require("./paragraph"));
15
13
 
16
14
  var _utilities = require("../utilities");
17
15
 
18
16
  var _metadata = _interopRequireDefault(require("./metadata"));
19
17
 
18
+ var _parser_warning = _interopRequireDefault(require("../parser/parser_warning"));
19
+
20
20
  var _constants = require("../constants");
21
21
 
22
- var _parser_warning = _interopRequireDefault(require("../parser/parser_warning"));
22
+ var _tag = _interopRequireWildcard(require("./tag"));
23
23
 
24
24
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
25
 
@@ -43,7 +43,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
43
43
 
44
44
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
45
45
 
46
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
46
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
47
47
 
48
48
  /**
49
49
  * Represents a song in a chord sheet. Currently a chord sheet can only have one song.
@@ -82,6 +82,7 @@ var Song = /*#__PURE__*/function () {
82
82
  this.currentParagraph = null;
83
83
  this.warnings = [];
84
84
  this.sectionType = _constants.NONE;
85
+ this.currentKey = null;
85
86
  }
86
87
 
87
88
  _createClass(Song, [{
@@ -150,6 +151,7 @@ var Song = /*#__PURE__*/function () {
150
151
  this.flushLine();
151
152
  this.currentLine = (0, _utilities.pushNew)(this.lines, _line["default"]);
152
153
  this.setCurrentLineType(this.sectionType);
154
+ this.currentLine.key = this.currentKey;
153
155
  return this.currentLine;
154
156
  }
155
157
  }, {
@@ -208,6 +210,8 @@ var Song = /*#__PURE__*/function () {
208
210
 
209
211
  if (tag.isMetaTag()) {
210
212
  this.setMetaData(tag.name, tag.value);
213
+ } else if (tag.name === _tag.TRANSPOSE) {
214
+ this.currentKey = tag.value;
211
215
  } else {
212
216
  this.setSectionTypeFromTag(tag);
213
217
  }
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports["default"] = exports._KEY = exports.YEAR = exports.TITLE = exports.TIME = exports.TEMPO = exports.SUBTITLE = exports.START_OF_VERSE = exports.START_OF_TAB = exports.START_OF_CHORUS = exports.READ_ONLY_TAGS = exports.META_TAGS = exports.LYRICIST = exports.KEY = exports.END_OF_VERSE = exports.END_OF_TAB = exports.END_OF_CHORUS = exports.DURATION = exports.COPYRIGHT = exports.COMPOSER = exports.COMMENT = exports.CAPO = exports.ARTIST = exports.ALBUM = void 0;
6
+ exports["default"] = exports._KEY = exports.YEAR = exports.TRANSPOSE = exports.TITLE = exports.TIME = exports.TEMPO = exports.SUBTITLE = exports.START_OF_VERSE = exports.START_OF_TAB = exports.START_OF_CHORUS = exports.READ_ONLY_TAGS = exports.META_TAGS = exports.LYRICIST = exports.KEY = exports.END_OF_VERSE = exports.END_OF_TAB = exports.END_OF_CHORUS = exports.DURATION = exports.COPYRIGHT = exports.COMPOSER = exports.COMMENT = exports.CAPO = exports.ARTIST = exports.ALBUM = void 0;
7
7
  exports.isReadonlyTag = isReadonlyTag;
8
8
 
9
9
  var _ALIASES;
@@ -12,7 +12,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
12
12
 
13
13
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
14
14
 
15
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
15
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
16
16
 
17
17
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
18
18
 
@@ -155,11 +155,18 @@ var TIME = 'time';
155
155
  exports.TIME = TIME;
156
156
  var TITLE = 'title';
157
157
  /**
158
- * Year meta directive. See https://www.chordpro.org/chordpro/directives-year/
158
+ * Transpose meta directive. See: https://www.chordpro.org/chordpro/directives-transpose/
159
159
  * @type {string}
160
160
  */
161
161
 
162
162
  exports.TITLE = TITLE;
163
+ var TRANSPOSE = 'transpose';
164
+ /**
165
+ * Year meta directive. See https://www.chordpro.org/chordpro/directives-year/
166
+ * @type {string}
167
+ */
168
+
169
+ exports.TRANSPOSE = TRANSPOSE;
163
170
  var YEAR = 'year';
164
171
  exports.YEAR = YEAR;
165
172
  var TITLE_SHORT = 't';
@@ -25,7 +25,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
25
25
 
26
26
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
27
27
 
28
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
28
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
29
29
 
30
30
  var CHORD_SHEET = 'chordSheet';
31
31
  var CHORD_LYRICS_PAIR = 'chordLyricsPair';
package/lib/constants.js CHANGED
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.VERSE = exports.TAB = exports.SYMBOL = exports.NUMERIC = exports.NONE = exports.INDETERMINATE = exports.CHORUS = void 0;
6
+ exports.VERSE = exports.TAB = exports.SYMBOL = exports.ROMAN_NUMERALS = exports.NUMERIC = exports.NUMERAL = exports.NONE = exports.INDETERMINATE = exports.CHORUS = void 0;
7
7
 
8
8
  /**
9
9
  * Used to mark a paragraph as verse
@@ -47,4 +47,8 @@ exports.TAB = TAB;
47
47
  var SYMBOL = 'symbol';
48
48
  exports.SYMBOL = SYMBOL;
49
49
  var NUMERIC = 'numeric';
50
- exports.NUMERIC = NUMERIC;
50
+ exports.NUMERIC = NUMERIC;
51
+ var NUMERAL = 'numeral';
52
+ exports.NUMERAL = NUMERAL;
53
+ var ROMAN_NUMERALS = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII'];
54
+ exports.ROMAN_NUMERALS = ROMAN_NUMERALS;
@@ -19,7 +19,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
19
19
 
20
20
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
21
21
 
22
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
22
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
23
23
 
24
24
  var NEW_LINE = '\n';
25
25
  /**
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -9,7 +9,7 @@ exports["default"] = void 0;
9
9
 
10
10
  var _handlebars = _interopRequireDefault(require("handlebars"));
11
11
 
12
- require("../handlebars_helpers");
12
+ require("../template_helpers");
13
13
 
14
14
  var _html_formatter = _interopRequireDefault(require("./html_formatter"));
15
15
 
@@ -23,9 +23,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
23
23
 
24
24
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
25
25
 
26
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
26
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
27
27
 
28
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
28
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
29
29
 
30
30
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
31
31