@stll/agent-input 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. package/dist/index.js +11 -9
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1607,15 +1607,17 @@ const normalizeLeaf = ({ annotation, path, readers, schema, value }) => {
1607
1607
  case "locale": return normalizeLocale(value);
1608
1608
  case "number": {
1609
1609
  const locale = annotation.locale;
1610
- if (annotation.range === "clamp") {
1611
- const types = isUnknownArray(schema["type"]) ? schema["type"] : [schema["type"]];
1612
- return normalizeNumberInRange(value, {
1613
- minimum: numericKeyword(schema, "minimum"),
1614
- maximum: numericKeyword(schema, "maximum"),
1615
- integer: types.includes("integer"),
1616
- ...locale === void 0 ? {} : { locale }
1617
- });
1618
- }
1610
+ const types = isUnknownArray(schema["type"]) ? schema["type"] : [schema["type"]];
1611
+ if (annotation.range === "clamp") return normalizeNumberInRange(value, {
1612
+ minimum: numericKeyword(schema, "minimum"),
1613
+ maximum: numericKeyword(schema, "maximum"),
1614
+ integer: types.includes("integer"),
1615
+ ...locale === void 0 ? {} : { locale }
1616
+ });
1617
+ if (types.includes("integer")) return normalizeNumberInRange(value, {
1618
+ integer: true,
1619
+ ...locale === void 0 ? {} : { locale }
1620
+ });
1619
1621
  return normalizeNumber(value, locale === void 0 ? void 0 : { locale });
1620
1622
  }
1621
1623
  case "string-list": return normalizeStringList(value, { split: "never" });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stll/agent-input",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Lenient readers for values agents write: dates, date bounds, date-format specs, numbers, booleans, locales, countries, enum and vocabulary values, ids, ELIs, string lists",
5
5
  "keywords": [
6
6
  "agent",
@@ -51,7 +51,7 @@
51
51
  "dependencies": {
52
52
  "@stll/country-codes": "^0.2.0",
53
53
  "@stll/template-conditions": "^0.6.2",
54
- "@stll/text-normalize": "^0.1.0",
54
+ "@stll/text-normalize": "^0.1.1",
55
55
  "@stll/time": "^0.1.0",
56
56
  "better-result": "3.0.1"
57
57
  },