Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
| 1 |
export const FEATURES = Object.freeze({ |
| 2 |
unicodeFlag: 1 << 0, |
| 3 |
dotAllFlag: 1 << 1, |
| 4 |
unicodePropertyEscape: 1 << 2, |
| 5 |
namedCaptureGroups: 1 << 3, |
| 6 |
unicodeSetsFlag_syntax: 1 << 4, |
| 7 |
unicodeSetsFlag: 1 << 5, |
| 8 |
duplicateNamedCaptureGroups: 1 << 6, |
| 9 |
}); |
| 10 |
|
| 11 |
// We can't use a symbol because this needs to always be the same, even if |
| 12 |
// this package isn't deduped by npm. e.g. |
| 13 |
// - node_modules/ |
| 14 |
// - @babel/plugin-regexp-features |
| 15 |
// - @babel/plugin-proposal-unicode-property-regex |
| 16 |
// - node_modules |
| 17 |
// - @babel-plugin-regexp-features |
| 18 |
export const featuresKey = "@babel/plugin-regexp-features/featuresKey"; |
| 19 |
export const runtimeKey = "@babel/plugin-regexp-features/runtimeKey"; |
| 20 |
|
| 21 |
type FeatureType = typeof FEATURES[keyof typeof FEATURES]; |
| 22 |
|
| 23 |
export function enableFeature(features: number, feature: FeatureType): number { |
| 24 |
return features | feature; |
| 25 |
} |
| 26 |
|
| 27 |
export function hasFeature(features: number, feature: FeatureType) { |
| 28 |
return !!(features & feature); |
| 29 |
} |