ac-sanitizer 3.10.1 → 3.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ <a name="3.10.2"></a>
2
+
3
+ ## [3.10.2](https://github.com/mmpro/ac-sanitizer/compare/v3.10.1..v3.10.2) (2022-04-28 11:21:08)
4
+
5
+
6
+ ### Bug Fix
7
+
8
+ * **App:** Detect int and float | MP | [1320003ec27cb1b85824aa0ad719b2d23b4ef5e5](https://github.com/mmpro/ac-sanitizer/commit/1320003ec27cb1b85824aa0ad719b2d23b4ef5e5)
9
+ Detect int and float
10
+ Related issues: [/issues#undefined](https://github.com//issues/undefined)
1
11
  <a name="3.10.1"></a>
2
12
 
3
13
  ## [3.10.1](https://github.com/mmpro/ac-sanitizer/compare/v3.10.0..v3.10.1) (2022-04-24 19:38:16)
package/index.js CHANGED
@@ -130,11 +130,14 @@ const sanitizer = function() {
130
130
  else if (_.isBoolean(value)) {
131
131
  field.type = 'boolean'
132
132
  }
133
- else if (_.isFinite(parseInt(value))) {
133
+ else if (_.isInteger(value)) {
134
134
  field.type = 'integer'
135
135
  }
136
+ else if (_.isFinite(value)) {
137
+ field.type = 'float'
138
+ }
136
139
  else {
137
- error = { message: fieldName + '_any_couldNotResolveType' }
140
+ error = { message: fieldName + '_couldNotResolveType' }
138
141
  }
139
142
  }
140
143
 
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "author": "Mark Poepping (https://www.admiralcloud.com)",
5
5
  "license": "MIT",
6
6
  "repository": "admiralcloud/ac-sanitizer",
7
- "version": "3.10.1",
7
+ "version": "3.10.2",
8
8
  "homepage": "https://www.admiralcloud.com",
9
9
  "dependencies": {
10
10
  "ac-countrylist": "^1.0.6",
package/test/tests/any.js CHANGED
@@ -14,7 +14,8 @@ module.exports = {
14
14
  { name: 'Any - with object', type: 'any', value: { a: 123 }, expected: { a: 123 } },
15
15
  { name: 'Any - with array', type: 'any', value: [1,2,3], expected: [1,2,3] },
16
16
  { name: 'Any - with array of objects', type: 'any', value: [{ a: 123 }], expected: [{ a: 123 }] },
17
- { name: 'Any - with float - cannot auto-detect', type: 'any', value: 123.235, error: 'any_typeIncorrect', additionalInfo: { value: 123.235, int: 123 } },
17
+ { name: 'Any - with float', type: 'any', value: 123.235, expected: 123.235 },
18
+ { name: 'Any - with Infinity - should fail', type: 'any', value: Infinity, error: 'any_couldNotResolveType' },
18
19
  ]
19
20
 
20
21
  _.forEach(baseTests, (test) => {