Socket
Socket
Sign inDemoInstall

rheactor-value-objects

Package Overview
Dependencies
Maintainers
3
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rheactor-value-objects - npm Package Compare versions

Comparing version 8.2.0 to 9.0.0

1

dist/domain.js

@@ -37,2 +37,3 @@ 'use strict';

}
domain = domain.toLowerCase();
if (!domainRegex.test(domain)) {

@@ -39,0 +40,0 @@ throw new _rheactorErrors.ValidationFailedError('Not a domain: ' + domain);

3

dist/email.js

@@ -16,3 +16,3 @@ 'use strict';

var emailRegex = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
var emailRegex = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-z\-0-9]+\.)+[a-z]{2,}))$/;

@@ -36,3 +36,2 @@ var EmailValue = exports.EmailValue = function () {

email = email.toLowerCase();
// http://emailregex.com/
if (!emailRegex.test(email)) {

@@ -39,0 +38,0 @@ throw new _rheactorErrors.ValidationFailedError('Not an email: ' + email);

{
"name": "rheactor-value-objects",
"description": "A collection of value objects",
"version": "8.2.0",
"version": "9.0.0",
"main": "dist/index.js",

@@ -6,0 +6,0 @@ "scripts": {

@@ -23,2 +23,3 @@ import {ValidationFailedError} from '@resourcefulhumans/rheactor-errors'

}
domain = domain.toLowerCase()
if (!domainRegex.test(domain)) {

@@ -25,0 +26,0 @@ throw new ValidationFailedError('Not a domain: ' + domain)

import {ValidationFailedError} from '@resourcefulhumans/rheactor-errors'
import {String as StringType, irreducible, maybe} from 'tcomb'
const emailRegex = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
const emailRegex = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-z\-0-9]+\.)+[a-z]{2,}))$/

@@ -21,3 +21,2 @@ export class EmailValue {

email = email.toLowerCase()
// http://emailregex.com/
if (!emailRegex.test(email)) {

@@ -24,0 +23,0 @@ throw new ValidationFailedError('Not an email: ' + email)

@@ -13,2 +13,3 @@ import {DomainValue, DomainValueType, MaybeDomainValueType} from '../src'

'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com', // 63 chars
'staRHs.example', // case-insensitive
'rh.com', // two letter

@@ -21,3 +22,3 @@ 'r.com', // one letter

let d = new DomainValue(domain)
expect(d.toString()).to.equal(domain)
expect(d.toString()).to.equal(domain.toLowerCase())
})

@@ -66,6 +67,9 @@ })

describe('.equals()', () => {
it('should return true for the same emails', () => {
it('should return true for the same domains', () => {
expect(new DomainValue('resourceful-humans.com').equals(new DomainValue('resourceful-humans.com'))).to.equal(true)
})
it('should return false for different emails', () => {
it('should return true for the same domains (acse-insensitive)', () => {
expect(new DomainValue('staRHs.example').equals(new DomainValue('starhs.example'))).to.equal(true)
})
it('should return false for different domains', () => {
expect(new DomainValue('resourceful-humans.com').equals(new DomainValue('resourceful-humans.de'))).to.equal(false)

@@ -72,0 +76,0 @@ })

@@ -14,6 +14,7 @@ import {EmailValue, EmailValueType, MaybeEmailValueType} from '../src'

'markus+example@resourceful-humans.com',
'Markus@Resourceful-Humans.com',
'm@cto.hiv'
].map(email => {
let d = new EmailValue(email)
expect(d.toString()).to.equal(email)
expect(d.toString()).to.equal(email.toLowerCase())
})

@@ -62,2 +63,5 @@ })

})
it('should return true for the same emails (case insensitive)', () => {
expect(new EmailValue('Markus@Resourceful-Humans.com').equals(new EmailValue('markus@resourceful-humans.com'))).to.equal(true)
})
it('should return false for different emails', () => {

@@ -64,0 +68,0 @@ expect(new EmailValue('markus@resourceful-humans.com').equals(new EmailValue('markus@resourceful-humans.de'))).to.equal(false)

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