g1.types(data)
returns the column data types. For example:
var data = [
{ a: 1, b: 1.1, c: "c", d: "2014-04-04", e: true, f: new Date() },
{ a: 2, b: 2 },
];
g.types(data); // {"a":"number","b":"number","c":"string","d":"string","e":"boolean","f":"date"}
g1.types(data, { convert: true }); // {"a":"number","b":"number","c":"string","d":"date","e":"boolean","f":"date"}
types()
accepts 2 parameters:
data
: a list of objectsoptions
: a dictionary that may contain these keys:convert
: converts values to the right type. For example, “1” is converted to 1. default: false
limit
: number of rows to evaluate. default: 1000ignore
: list of values that should be ignored. default: [null, undefined]
Rules:
limit
rowsignore
option. Only consider the restconvert
is false
, then for each column:date
number
string
boolean
null
mixed
convert
is true
, then for each column:date
number
boolean
null
string