Socket
Book a DemoInstallSign in
Socket

moml

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

moml

Minimalist Object Markup Language.

Source
npmnpm
Version
0.4.1
Version published
Maintainers
1
Created
Source

MOML

Minimalist Object Markup Language.

Installation

$ npm install moml

Spec

MOML is kind of YAML in disguise.

It uses the outstanding and mature js-yaml YAML 1.2 parser and serializer under the hood.
MOML only adds a couple of neat transformations, so the markup itself can be more visually appealing.

The MOML parser produces JSON output.

Keys

They are case-insensitve and always lower case: author, Author and AUTHOR all result in author.
Pick your own visual style.

Author: Sam Text

=>

{
    "author": "Sam Text"
}

Arrays

Just suffix the respective keys with square brackets. That's all.

Tags[]: explosive, story

=>

{
    "tags": [
        "explosive", 
        "story"
    ]
}

Multi-line

Simply continue on the next line with the same indentation.
To prevent a newline (\n) supply a trailing underscore.

Remarks:    This is a multiline remark.
            You only have to youse the same indentation _
            on subsequent lines. 
            This improves readybility a lot!

=>


{
    "remarks": "This is a multiline remark.\nYou only have to youse the same indentation on subsequent lines.\nThis improves readybility a lot!"
}

Multi-line to Array conversion

Remarks[]:  This is a multiline remark.
            You only have to youse the same indentation _
            on subsequent lines.
            This improves readybility a lot!

=>

{
    "remarks": [
        "This is a multiline remark.",
        "You only have to youse the same indentation on subsequent lines.",
        "This improves readybility a lot!"
    ]
}

Full example for e.g. markdown metadata

Title:      My First Day with MOML

Author:     Sam Text

Date:       12/06/2016

Tags[]:     explosive, story

Remarks:    This is a multiline remark.
            You only have to youse the same indentation _
            on subsequent lines. 
            This improves readybility a lot!

=>


{
    "title": "My First Day with MOML",
    "author": "Sam Text",
    "tags": [
        "explosive", 
        "story"
    ],
    "remarks": "This is a multiline remark.\nYou only have to youse the same indentation on subsequent lines.\nThis improves readybility a lot!"
}

It's as easy as pie, isn't it?

License

ISC

Keywords

object

FAQs

Package last updated on 10 Dec 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts