File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed
Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -132,19 +132,25 @@ const sugarFreeMolecule = (value: Molecule) => {
132132 return either . makeRight ( openBrace + closeBrace )
133133 } else {
134134 const keyValuePairsAsStrings : string [ ] = [ ]
135+ let ordinalPropertyKeyCounter = 0n
135136 for ( const [ propertyKey , propertyValue ] of entries ) {
136137 const valueAsStringResult = atomOrMolecule ( propertyValue )
137138 if ( either . isLeft ( valueAsStringResult ) ) {
138139 return valueAsStringResult
139140 }
140141
141- keyValuePairsAsStrings . push (
142- // TODO: Intelligently omit all ordinal property keys, not just `0`.
143- ( propertyKey === '0'
144- ? ''
145- : kleur . cyan ( quoteIfNecessary ( propertyKey ) . concat ( colon ) ) . concat ( ' ' )
146- ) . concat ( valueAsStringResult . value ) ,
147- )
142+ // Omit ordinal property keys:
143+ if ( propertyKey === String ( ordinalPropertyKeyCounter ) ) {
144+ keyValuePairsAsStrings . push ( valueAsStringResult . value )
145+ ordinalPropertyKeyCounter += 1n
146+ } else {
147+ keyValuePairsAsStrings . push (
148+ kleur
149+ . cyan ( quoteIfNecessary ( propertyKey ) . concat ( colon ) )
150+ . concat ( ' ' )
151+ . concat ( valueAsStringResult . value ) ,
152+ )
153+ }
148154 }
149155
150156 return either . makeRight (
You can’t perform that action at this time.
0 commit comments