Skip to content

jevko/easyjevko.lua

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

easyjevko.lua logo

easyjevko.lua

A library for Easy Jevko, a simple format built on Jevko.

Transforms Jevko to Lua values and back.

Dependencies

jevko.lua 0.1.0 -- a copy is included.

Features

  • Simple
  • Lightweight: ~ 4 KiB.

Usage

Copy the easyjevko.lua file into your project and require it:

easyjevko = require "easyjevko"

You can now use the following functions:

easyjevko.from_string(str)

Input: string which contains a Jevko.

Description:

  • A Jevko without subjevkos is converted to a string.
  • A Jevko with subjevkos is converted to a table. The first subjevko decides the kind of table:
    • If the first subjevko has empty or whitespace-only prefix then the Jevko will be converted to an array.
    • Otherwise the Jevko will be converted to a map.
  • Leading and trailing spaces in object keys are ignored.

Output: Lua table/string.

easyjevko.from_string("a [b]") // -> {a = "b"}

easyjevko.to_string(value)

easyjevko.to_pretty_string(value)

easyjevko.from_jevko(jevko)

easyjevko.to_jevko(value)

easyjevko.encode_pretty(jev)

License

MIT