- Revert prefer-named-capture-group due to apparently problematic Babel plugin

This commit is contained in:
Brett Zamir
2019-11-16 10:08:38 +08:00
parent cd0bdd9cce
commit 19f7962c4a
33 changed files with 315 additions and 2146 deletions

View File

@@ -1,4 +1,4 @@
/* eslint-disable new-cap, class-methods-use-this, prefer-named-capture-group */
/* eslint-disable new-cap, class-methods-use-this */
// Todo: Compare with latest canvg (add any improvements of ours) and add full JSDocs (denoting links to standard APIs and which are custom): https://github.com/canvg/canvg
/**
* canvg.js - Javascript SVG parser and renderer on Canvas

View File

@@ -154,21 +154,24 @@ const simpleColors = {
// array of color definition objects
const colorDefs = [
{
re: /^rgb\((?<r>\d{1,3}),\s*(?<g>\d{1,3}),\s*(?<b>\d{1,3})\)$/,
re: /^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,
// re: /^rgb\((?<r>\d{1,3}),\s*(?<g>\d{1,3}),\s*(?<b>\d{1,3})\)$/,
example: ['rgb(123, 234, 45)', 'rgb(255,234,245)'],
process (_, ...bits) {
return bits.map((b) => parseInt(b));
}
},
{
re: /^(?<r>\w{2})(?<g>\w{2})(?<b>\w{2})$/,
re: /^(\w{2})(\w{2})(\w{2})$/,
// re: /^(?<r>\w{2})(?<g>\w{2})(?<b>\w{2})$/,
example: ['#00ff00', '336699'],
process (_, ...bits) {
return bits.map((b) => parseInt(b, 16));
}
},
{
re: /^(?<r>\w{1})(?<g>\w{1})(?<b>\w{1})$/,
re: /^(\w{1})(\w{1})(\w{1})$/,
// re: /^(?<r>\w{1})(?<g>\w{1})(?<b>\w{1})$/,
example: ['#fb0', 'f0f'],
process (_, ...bits) {
return bits.map((b) => parseInt(b + b, 16));