How to use the @jscad/io.jsonDeSerializer function in @jscad/io

To help you get started, we’ve selected a few @jscad/io examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jscad / OpenJSCAD.org / packages / web / src / io / conversionWorker.js View on Github external
case 'stl':
              const deserializeStl = require('@jscad/io').stlDeSerializer.deserialize
              r.source = r.converted = deserializeStl(data.source, data.filename, options)
              break
            case 'js':
              r.source = r.converted = data.source
              break
            case 'jscad':
              r.source = r.converted = data.source
              break
            case 'svg':
              const deserializeSvg = require('@jscad/io').svgDeSerializer.deserialize
              r.source = r.converted = deserializeSvg(data.source, data.filename, options)
              break
            case 'json':
              const deserializeJson = require('@jscad/io').jsonDeSerializer.deserialize
              r.source = r.converted = deserializeJson(data.source, data.filename, options)
              break
            default:
              r.source = r.converted = '// Invalid file type in conversion (' + e + ')'
              break
          }
        }
      }
    }
    postMessage(r)
  }
}
github jscad / OpenJSCAD.org / packages / cli / generateOutputData.js View on Github external
      json: data => require('@jscad/io').jsonDeSerializer.deserialize(data.source, data.inputFile, options),
      jscad: data => data.source,