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

tv4-formats

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tv4-formats - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

.travis.yml

8

index.js

@@ -41,2 +41,10 @@ (function () {

};
exports['credit-card-number'] = function (value) {
if (validator.isCreditCard(value)) {
return null;
}
return 'A valid credit card number format expected';
};
}());

2

package.json
{
"name": "tv4-formats",
"version": "0.1.0",
"version": "0.2.0",
"description": "Common JSON Schema string format constraints in the form of tv4 validator callbacks",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -0,1 +1,3 @@

[![Build Status](https://secure.travis-ci.org/ikr/tv4-formats.png)](http://travis-ci.org/ikr/tv4-formats)
# About

@@ -36,1 +38,2 @@

* uri
* credit-card-number

@@ -75,5 +75,23 @@ describe('tv4-formats', function () {

it('validates negatively', function () {
assert(formats.email('+41 43 000 00 00').length > 0);
assert(formats.uri('+41 43 000 00 00').length > 0);
});
});
describe('credit-card-number', function () {
it('is defined', function () {
assert.strictEqual(typeof formats['credit-card-number'], 'function');
});
it('validates positively', function () {
assert.strictEqual(formats['credit-card-number']('4242424242424242'), null);
});
it('validates negatively on garbage', function () {
assert(formats['credit-card-number']('MA CC NUM').length > 0);
});
it('validates negatively on a number violating the checksum', function () {
assert(formats['credit-card-number']('1000000000000000').length > 0);
});
});
});
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