Skip to content

Commit 23479d1

Browse files
committed
use slice instead of a regex replace
Introducing MBDD: micro-benchmark driven development!
1 parent d2b5d5b commit 23479d1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/tailwindcss/src/theme.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import type { AtRule } from './ast'
22
import { escape } from './utils/escape'
33

4-
const ESCAPED_STAR_REGEX = /-\\\*$/
5-
64
export const enum ThemeOptions {
75
NONE = 0,
86
INLINE = 1 << 0,
@@ -43,7 +41,9 @@ export class Theme {
4341
) {}
4442

4543
add(key: string, value: string, options = ThemeOptions.NONE): void {
46-
key = key.replace(ESCAPED_STAR_REGEX, '-*')
44+
if (key.endsWith('\\*')) {
45+
key = key.slice(0, -2) + '*'
46+
}
4747

4848
if (key.endsWith('-*')) {
4949
if (value !== 'initial') {

0 commit comments

Comments
 (0)