protodef-yaml
Advanced tools
Comparing version 1.5.1 to 1.5.2
@@ -76,3 +76,7 @@ const fs = globalThis.window ? null : require('fs') | ||
key = key.trim(); val = val ? val.trim() : '' | ||
if (key == '_') key = '__' + i | ||
if (key === '_') { | ||
const nkey = '__' + i | ||
lines[i] = lines[i].replace(key, nkey) | ||
key = nkey | ||
} | ||
if (!key) continue | ||
@@ -102,2 +106,6 @@ if (key.startsWith('!')) { | ||
lines[i] = lines[i].replace(key, nkey) | ||
// Enforce parsing as string if we have a float like 1.20 | ||
if (!isNaN(val) && (val.includes('.') && val.endsWith('0'))) { | ||
lines[i] = lines[i].replace(': ', ': !!str ') | ||
} | ||
continue | ||
@@ -261,3 +269,3 @@ } | ||
if (Array.isArray(val) && !key.startsWith('%')) { // pass thru protodef json | ||
if (key === '_') ctxPush({ anon: true, type: val }) | ||
if (key.startsWith('__')) ctxPush({ anon: true, type: val }) | ||
else ctxPush({ name: key, type: val }) | ||
@@ -264,0 +272,0 @@ } else if (typeof val === 'object') { |
@@ -0,1 +1,5 @@ | ||
## 1.5.2 | ||
* [Parse !special fields as string if we have a float-string parsing disreprency](https://github.com/extremeheat/protodef-yaml/commit/aecec767963b4248b41de01c652f34776ae21382) (thanks @extremeheat) | ||
* [Fix anonymous key handling in yaml compiler](https://github.com/extremeheat/protodef-yaml/commit/39be9cf183115336fe578aa525ec424ae5b88a61) (thanks @extremeheat) | ||
## 1.5.1 | ||
@@ -2,0 +6,0 @@ * [Fix %switch->%array handling for inline ProtoDef JSON](https://github.com/extremeheat/protodef-yaml/commit/eaabc2b3b3471da2f488f36eae183c28ed6b4d11) (thanks @extremeheat) |
{ | ||
"name": "protodef-yaml", | ||
"version": "1.5.1", | ||
"version": "1.5.2", | ||
"description": "Transforms YAML-like syntax to ProtoDef JSON schema", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
1379155
30701