10.0.0 • Published 7 years ago

rheactor-value-objects v10.0.0

Weekly downloads
40
License
MIT
Repository
github
Last release
7 years ago

rheactor-value-objects

Build Status monitored by greenkeeper.io js-standard-style semantic-release Test Coverage Code Climate

NPM

A collection of value objects

Common API

ValueType()

This method exposes a tcomb type validation base on instanceof or the name of the type and it's properties.

Note that instanceof can't be used always because having this check will return false, because the application using the value-objects package will create an instance that Node.js thinks to be from a different location that the one referenced in this package's uri.js

# app.js
const URIValue = require('rheactor-value-objects/uri')
let u = new URIValue(…)
URIValue.Type(u) // will fail

# uri.js
URIValue.Type = t.irreducible('URIValue', (x) => x instanceof URIValue)

.equals()

You can compare two value objects with the .equals() method:

const ex = new URIValue('https://example.com') 
ex.equals(new URIValue('https://example.com')) // -> true
ex.equals(new URIValue('https://acme.com'))    // -> false

.is()

You can check if a given value is of this value object:

const ex = new URIValue('https://example.com') 
URIValue.is(ex)    // -> true
DomainValue.is(ex) // -> false
10.0.0

7 years ago

9.1.0

7 years ago

9.0.1

7 years ago

9.0.0

7 years ago

8.2.0

7 years ago

8.1.0

7 years ago

8.0.0

7 years ago

7.0.0

7 years ago

6.0.0

7 years ago

5.0.0

7 years ago

4.3.2

7 years ago

4.3.2-1

7 years ago

4.3.1

7 years ago

4.3.0

7 years ago

4.2.2

7 years ago

4.2.1

7 years ago

4.2.0

7 years ago

4.1.0

7 years ago

4.0.1

7 years ago

4.0.0

7 years ago

3.6.0

7 years ago

3.5.0

7 years ago

3.4.0

7 years ago

3.3.0

7 years ago

3.2.0

7 years ago

3.1.0

7 years ago

3.0.0

8 years ago

2.0.0

8 years ago

1.6.1

8 years ago

1.6.0

8 years ago

1.5.1

8 years ago

1.5.0

8 years ago

1.4.0

8 years ago

1.3.0

8 years ago

1.2.0

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago