All Projects → killmenot → valid-data-url

killmenot / valid-data-url

Licence: MIT License
Detect if a string is a data URL

Programming Languages

javascript
184084 projects - #8 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to valid-data-url

validation
Validation on Laravel 5.X|6.X|7.X|8.X
Stars: ✭ 26 (+52.94%)
Mutual labels:  validation
fefe
Validate, sanitize and transform values with proper TypeScript types and zero dependencies.
Stars: ✭ 34 (+100%)
Mutual labels:  validation
is-valid-domain
Validate domain name in JavaScript
Stars: ✭ 50 (+194.12%)
Mutual labels:  validation
laravel-pwned-passwords
Simple Laravel validation rule that allows you to prevent or limit the re-use of passwords that are known to be pwned (unsafe). Based on TroyHunt's Have I Been Pwned (https://haveibeenpwned.com)
Stars: ✭ 67 (+294.12%)
Mutual labels:  validation
validator
💯Go Struct and Field validation, including Cross Field, Cross Struct, Map, Slice and Array diving
Stars: ✭ 9,721 (+57082.35%)
Mutual labels:  validation
apple-receipt
Apple InAppPurchase Receipt - Models, Parser, Validator
Stars: ✭ 25 (+47.06%)
Mutual labels:  validation
oolong
oolong 🍵 : create and administrate validation tests for typical automated content analysis tools.
Stars: ✭ 40 (+135.29%)
Mutual labels:  validation
validate
Modern lightweight library without dependencies for the data validation from single input tag
Stars: ✭ 24 (+41.18%)
Mutual labels:  validation
ttv
A command line tool for splitting files into test, train, and validation sets.
Stars: ✭ 38 (+123.53%)
Mutual labels:  validation
validada
Another library for defensive data analysis.
Stars: ✭ 29 (+70.59%)
Mutual labels:  validation
xrechnung-schematron
Schematron rules for the German CIUS (XRechnung) of EN16931:2017
Stars: ✭ 19 (+11.76%)
Mutual labels:  validation
webargs-starlette
Declarative request parsing and validation for Starlette with webargs
Stars: ✭ 36 (+111.76%)
Mutual labels:  validation
nexus-validate
🔑 Add argument validation to your GraphQL Nexus API.
Stars: ✭ 29 (+70.59%)
Mutual labels:  validation
excel validator
Python script to validate data in Excel files
Stars: ✭ 14 (-17.65%)
Mutual labels:  validation
strickland
Strickland is a JavaScript validation framework with a focus on extensibility and composition
Stars: ✭ 16 (-5.88%)
Mutual labels:  validation
Swiftz-Validation
A data structure for validations. It implements the applicative functor interface
Stars: ✭ 15 (-11.76%)
Mutual labels:  validation
flask-pydantic
flask extension for integration with the awesome pydantic package
Stars: ✭ 181 (+964.71%)
Mutual labels:  validation
magic-bytes
A library for detecting file types.
Stars: ✭ 20 (+17.65%)
Mutual labels:  validation
js-form-validator
Javascript form validation. Pure JS. No jQuery
Stars: ✭ 38 (+123.53%)
Mutual labels:  validation
ruby-magic
Simple interface to libmagic for Ruby Programming Language
Stars: ✭ 23 (+35.29%)
Mutual labels:  validation

Detect if a string is a data URL

Build Status Coverage Status Dependency Status Dev Dependency Status npm npm

Based on Brian Grinstead's solution https://gist.github.com/bgrins/6194623. Special thanks to Jamie Davis for helping to fix ReDoS exploit.

Syntax

The "data" URL scheme is described here RFC2397

dataurl    := "data:" [ mediatype ] [ ";base64" ] "," data
mediatype  := [ type "/" subtype ] *( ";" parameter )
data       := *urlchar
parameter  := attribute "=" value

where urlchar is imported from RFC2396, and type, subtype, attribute and value are the corresponding tokens from RFC2045, represented using URL escaped encoding of RFC2396 as necessary.

Attribute values in RFC2045 are allowed to be either represented as tokens or as quoted strings. However, within a data URL, the quoted-string representation would be awkward, since the quote mark is itself not a valid urlchar. For this reason, parameter values should use the URL Escaped encoding instead of quoted string if the parameter values contain any tspecial.

The ;base64 extension is distinguishable from a content-type parameter by the fact that it doesn't have a following = sign.

Install

npm install valid-data-url

Example

'use strict';

var validDataUrl = require('valid-data-url');
var isValid = validDataUrl('data:text/plain;base64,SGVsbG8sIFdvcmxkIQ%3D%3D'); // true

People

The original author is Brian Grinstead

Contributors

Licence

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].