Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should allow null type #280

Closed
carantunes opened this issue Sep 25, 2018 · 3 comments
Closed

Should allow null type #280

carantunes opened this issue Sep 25, 2018 · 3 comments
Milestone

Comments

@carantunes
Copy link

If null is set, it should be converted to null, and not a string "null"

@carantunes
Copy link
Author

function nullType(item) {
    return null;
}


function dynamicType(item) {
  var trimed = item.trim();
  if (trimed === "") {
    return stringType(item);
  }
  if (numReg.test(trimed)) {
    return numberType(item);
  } else if (trimed.length === 5 && trimed.toLowerCase() === "false" || trimed.length === 4 && trimed.toLowerCase() === "true") {
    return booleanType(item);
  } else if (trimed.length === 4 && trimed.toLowerCase() === "null") {
    return nullType(item);
  } else if (trimed[0] === "{" && trimed[trimed.length - 1] === "}" || trimed[0] === "[" && trimed[trimed.length - 1] === "]") {
    return jsonType(item);
  } else {
    return stringType(item);
  }
}

@Keyang Keyang added this to the 2.0.9 milestone Oct 22, 2018
@Keyang
Copy link
Owner

Keyang commented Jun 26, 2019

developed in 2.0.9 through nullObject parameter

@Keyang Keyang closed this as completed Jun 26, 2019
@ataravati
Copy link

@Keyang Is there anything I need to set in order for this to work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants