@xrplkit/xls26 2.0.1 → 2.0.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/xls26.js +13 -12
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xrplkit/xls26",
3
3
  "type": "module",
4
- "version": "2.0.1",
4
+ "version": "2.0.2",
5
5
  "main": "xls26.js",
6
6
  "dependencies": {
7
7
  "@xrplkit/toml": "1.0.0"
package/xls26.js CHANGED
@@ -139,7 +139,7 @@ const weblinkFields = [
139
139
 
140
140
  export function parse(str){
141
141
  try{
142
- var toml = parseToml(str, 'camelCase')
142
+ var toml = parseToml(str)
143
143
  }catch(error){
144
144
  throw new Error(`Failed to parse .toml: Syntax error at line ${error.line}:${error.column}`)
145
145
  }
@@ -148,8 +148,9 @@ export function parse(str){
148
148
  let tokens = []
149
149
  let issues = []
150
150
 
151
- if(toml.issuers){
152
- for(let stanza of toml.issuers){
151
+
152
+ if(toml.ISSUERS){
153
+ for(let stanza of toml.ISSUERS){
153
154
  let { valid, parsed: issuer, issues: issuerIssues } = parseStanza(stanza, issuerFields)
154
155
 
155
156
  if(valid)
@@ -161,13 +162,13 @@ export function parse(str){
161
162
  )
162
163
  )
163
164
 
164
- if(valid && stanza.weblinks){
165
- for(let substanza of stanza.weblinks){
165
+ if(valid && stanza.WEBLINKS){
166
+ for(let substanza of stanza.WEBLINKS){
166
167
  let { valid, parsed: weblink, issues: weblinkIssues } = parseStanza(substanza, weblinkFields)
167
168
 
168
169
  if(valid){
169
170
  issuer.weblinks = [
170
- ...(token.weblinks || []),
171
+ ...(issuer.weblinks || []),
171
172
  weblink
172
173
  ]
173
174
  }
@@ -182,8 +183,8 @@ export function parse(str){
182
183
  }
183
184
  }
184
185
 
185
- if(toml.tokens){
186
- for(let stanza of toml.tokens){
186
+ if(toml.TOKENS){
187
+ for(let stanza of toml.TOKENS){
187
188
  let { valid, parsed: token, issues: tokenIssues } = parseStanza(stanza, tokenFields)
188
189
 
189
190
  if(valid)
@@ -195,8 +196,8 @@ export function parse(str){
195
196
  )
196
197
  )
197
198
 
198
- if(valid && stanza.weblinks){
199
- for(let substanza of stanza.weblinks){
199
+ if(valid && stanza.WEBLINKS){
200
+ for(let substanza of stanza.WEBLINKS){
200
201
  let { valid, parsed: weblink, issues: weblinkIssues } = parseStanza(substanza, weblinkFields)
201
202
 
202
203
  if(valid){
@@ -236,7 +237,7 @@ function parseStanza(stanza, schemas){
236
237
  keys.push(...alternativeKeys)
237
238
 
238
239
  for(let k of keys){
239
- if(!stanza.hasOwnProperty(k))
240
+ if(stanza[k] === undefined)
240
241
  continue
241
242
 
242
243
  let value = stanza[k]
@@ -254,7 +255,7 @@ function parseStanza(stanza, schemas){
254
255
  break
255
256
  }
256
257
 
257
- if(essential && !parsed.hasOwnProperty(key)){
258
+ if(essential && parsed[key] === undefined){
258
259
  issues.push(`${key} field missing: skipping stanza`)
259
260
  valid = false
260
261
  }