type-analyzer
Advanced tools
Comparing version 0.2.3 to 0.2.4
@@ -19,2 +19,8 @@ | ||
#### [0.2.4] - Jan 08 2020 (3ab0fb8) | ||
2cf038e Treat large numeric columns as numbers | ||
#### [0.2.3] - Oct 08 2019 (371f641) | ||
986ce5c [Enhancement] Add support for Array and Object data type) | ||
#### [0.2.2] - Oct 07 2019 (b913061) | ||
@@ -21,0 +27,0 @@ 37de75d add eslint and prettier |
{ | ||
"name": "type-analyzer", | ||
"description": "Infer types from columns in JSON", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "repository": { |
@@ -56,5 +56,13 @@ // Copyright (c) 2017 Uber Technologies, Inc. | ||
// numbers: | ||
// 1, 2, 3 | ||
VALIDATOR_MAP[DATA_TYPES.INT] = Utils.buildRegexCheck('isInt'); | ||
// 1, 2, 3, +40, 15,121 | ||
const intRegexCheck = Utils.buildRegexCheck('isInt'); | ||
VALIDATOR_MAP[DATA_TYPES.INT] = function isInt(value) { | ||
if (intRegexCheck(value)) { | ||
var asNum = parseInt(value.toString().replace(/(\+|,)/g, ''), 10); | ||
return asNum > Number.MIN_SAFE_INTEGER && asNum < Number.MAX_SAFE_INTEGER; | ||
} | ||
return false; | ||
}; | ||
// 1.1, 2.2, 3.3 | ||
@@ -61,0 +69,0 @@ VALIDATOR_MAP[DATA_TYPES.FLOAT] = Utils.buildRegexCheck('isFloat'); |
@@ -164,2 +164,9 @@ // Copyright (c) 2017 Uber Technologies, Inc. | ||
assert.end(); | ||
arr = ['182891173641581479', '2e53', '1e16', 182891173641581479].map(mapArr); | ||
assert.equal( | ||
Analyzer.computeColMeta(arr)[0].type, | ||
'NUMBER', | ||
'Inteprets large numeric values as numbers' | ||
); | ||
}); | ||
@@ -166,0 +173,0 @@ |
@@ -33,3 +33,3 @@ // Copyright (c) 2017 Uber Technologies, Inc. | ||
var start = Date.now(); | ||
spec.apply(null, arguments); | ||
spec(...arguments); | ||
var duration = Date.now() - start; | ||
@@ -36,0 +36,0 @@ testDurations.push({name: name, duration: duration}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
152510
1887