@prettier/parse-srcset
TypeScript icon, indicating that this package has built-in type declarations

3.1.0 • Public • Published

@prettier/parse-srcset

This repository is a fork of https://github.com/albell/parse-srcset for Prettier.


A javascript parser for the HTML5 srcset attribute, based on the WHATWG reference algorithm. It has an extensive test suite based on the W3C srcset conformance checker.

Installation

yarn add @prettier/parse-srcset

Usage

import parseSrcset from "@prettier/parse-srcset";

parseSrcset('elva-fairy-320w.jpg, elva-fairy-480w.jpg 1.5x, elva-fairy-640w.jpg 2x');
/*
[
  { source: { value: 'elva-fairy-320w.jpg', startOffset: 0 } },
  {
    source: { value: 'elva-fairy-480w.jpg', startOffset: 21 },
    density: { value: 1.5 }
  },
  {
    source: { value: 'elva-fairy-640w.jpg', startOffset: 47 },
    density: { value: 2 }
  }
]
*/

Readme

Keywords

none

Package Sidebar

Install

npm i @prettier/parse-srcset

Weekly Downloads

376

Version

3.1.0

License

MIT

Unpacked Size

15.6 kB

Total Files

5

Last publish

Collaborators

  • sosukesuzuki
  • fisker
  • suchipi
  • mgrip
  • czosel
  • patrick91
  • zimme
  • azz
  • vjeux
  • evilebottnawi
  • kddeisz
  • shinigami92
  • j-f
  • lydell