Skip to content

sonofmagic/CSS.unescape

Repository files navigation

css.unescape

Install

<npm|yarn|pnpm> add css.unescape

Usage

import { cssUnescape } from 'css.unescape'

cssUnescape('\\31 2345') // -> '12345'

cssUnescape('\\32 xlctext-base') // -> '2xlctext-base'

cssUnescape('a\0b') // -> 'a\uFFFDb'

cssUnescape('a\0b', {
  slashZero: false
}) // -> 'a\u0000b'

Options

export interface CssUnescapeOptions {
  // default true
  // if '\0' -> '\uFFFD'
  slashZero?: boolean
}

License

This polyfill is available under the MIT license.