Integer => IntegerEntity, No more primitive

This commit is contained in:
barsdeveloper
2021-11-23 21:01:07 +01:00
parent 6a3e2cc36f
commit c774886a2e
8 changed files with 52 additions and 85 deletions

View File

@@ -1,17 +1,12 @@
import Integer from "./primitive/Integer"
export default class TypeInitialization {
static sanitize(value) {
if (!(value instanceof Object)) {
return value // Is already primitive
}
if (value instanceof Boolean || value instanceof Integer || value instanceof Number) {
if (value instanceof Boolean || value instanceof Number || value instanceof String) {
return value.valueOf()
}
if (value instanceof String) {
return value.toString()
}
return value
}