#!/usr/bin/env node

const process = require('process')

const esmImport = require('esm')(module)
const geojson = esmImport('../src/geojson.js')

let data = ''
process.stdin.on('readable', () => {
    while ((chunk = process.stdin.read()) !== null) {
        data += chunk
    }
})

process.stdin.on('end', () => {
    process.stdout.write(processData(data))
})

function processData(data) {
    const json = JSON.parse(data)
    return geojson.minify(json)
}
