Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@prettier/parse-srcset

Package Overview
Dependencies
Maintainers
13
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@prettier/parse-srcset

A spec-conformant JavaScript parser for the HTML5 srcset attribute

  • 3.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
13
Created
Source

@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 }
  }
]
*/

FAQs

Package last updated on 07 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc