typehardeningrc
Version:
Type hardening checker
68 lines (40 loc) • 932 B
Markdown
Type hardening is a simple type / type limit checker
```javascript
const typeHardening = new (require('./index.js')).base();
```
| type | comment
|-----------|-----------
| any |
| array |
| boolean |
| float |
| function |
| integer |
| list |
| select |
| string |
```javascript
const typeObject = { // variable type description
'type':'string', // variable type
'list': [], // list of posible values (optional)
'max': [], // maximum value limit (optional)
'min': [] // minimum value limit (optional)
},
```
```javacript
typeHardening.check(
typeObject,
'value' // checkable value
);
// expectation is boolean
```
```javacript
typeHardening.getDefault( typeObject );
// expectation is any
```