JSPM

data-uri-regex

0.1.4
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5429
  • Score
    100M100P100Q120472F
  • License MIT

Regexp for data-uri

Package Exports

  • data-uri-regex

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (data-uri-regex) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

data-uri-regex Build Status

Regexp for data-uri

Install

$ npm install --save data-uri-regex

Usage

const dataUriRegex = require('data-uri-regex');

var png = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=='

png.match(dataUriRegex());
//=> true

dataUriRegex().test(png);
//=> true

dataUriRegex().exec(png)[1];
//=> 'data:'

dataUriRegex().exec(png)[2];
//=> 'image/png'

dataUriRegex().exec(png)[3];
//=> 'base64'

dataUriRegex().exec(png)[4];
//=> 'iVB'

API

dataUriRegex()

It will return the instance of RegExp() for match data-uri strings.

License

MIT © ragingwind