Giter Site home page Giter Site logo

dag0310 / csvml Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 40 KB

Parser for structured data in a comma-separated and line-based format.

Home Page: https://dag0310.github.io/csvml/

License: MIT License

HTML 30.22% JavaScript 69.78%
csv json language markup nodejs

csvml's Introduction

CSVML - CSV Markup Language

Structure data in a comma-separated and line-based format. Or: I had one very specific use-case for easily editable structured data and made it everyone else's problem.

Suggested file extension: .csvml

Installation

npm install --save csvml

Usage

<script type="module">
import Csvml from './csvml.js';

const csvData = `command,shutters_seconds
time,lat,lon

shutters_down,10
sunset,47.076668,15.421371`

const obj = Csvml.parse(csvData);
</script>

Syntax

  • The first entry of lines defines the property names
  • All subsequent entries are data grouped by comma , or a single line break \n in the corresponding format of the first definition entry
  • All entries are separated by double line breaks \n\n
  • All properties are optional
  • Entries starting with # are ignored (commented-out)

Example of a CSVML document

command,shutters_seconds
time,lat,lon

shutters_down,10
sunset,47.076668,15.421371

#shutters_up
09:00

#light_on
03:40

light_off
23:00

#shutters_down,2
14:30

... parses to JSON:

[
  {
    "command": "shutters_down",
    "shutters_seconds": 10,
    "time": "sunset",
    "lat": 47.076668,
    "lon": 15.421371
  },
  {
    "command": "light_off",
    "time": "23:00"
  }
]

csvml's People

Contributors

dag0310 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.