Socket
Book a DemoInstallSign in
Socket

bracko

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bracko

Bracko is an easy-to-learn data format

1.0.0
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

Bracko

Bracko is a simple data format. This NPM package has a parse, stringify, jsonToBracko, and a brackoToJson method.

Syntax

General syntax

[Key]: Value

anything that's not in this format will be treated as a comment

Overriding

[Key]: Value
[Key]: Overriding the value

this will override [Key] to "Overriding the value"
in other words, this will return { Key: "Overriding the value" }

Allowed characters in keys

[You can use spaces in keys]: and it'll work!
[You can also use numbers and special characters!11_.]: and it'll still work
[Everything except new lines]: will work.

Keys within values

[Person]: -
    [Name]: John
    [Surname]: Doe
    [Birthday]: -
        [Day]: 1
        [Month]: 1
        [Year]: 2000
    [Birthday]: -
[Person]: -

parsing this returns:
{
    Person: {
        Name: "John",
        Surname: "Doe",
        Birthday: {
            Day: "1",
            Month: "1",
            Year: "2000"
        }
    }
}

Library Usage

Importing

const Bracko = require("bracko");

Parsing

Bracko.parse(`
[Name]: John
[Surname]: Doe
[Birthday]: Jan 1st 2000
`);

/*
    {
        Name: "John",
        Surname: "Doe",
        Birthday: "Jan 1st 2000"
    }
*/

Stringifying

Bracko.stringify({
    name: "John",
    surname: "Doe",
    birthday: "Jan 1st 2000"
});

/*
[name]:John
[surname]:Doe
[birthday]:Jan 1st 2000
*/

Converting to JSON

Bracko.brackoToJson(`
[Name]: John
[Surname]: Doe
[Birthday]: Jan 1st 2000
`);
/*
    {"Name":"John","Surname":"Doe","Birthday":"Jan 1st 2000"}
*/

Bracko.brackoToJson(`
[Person]: -
    [Name]: John
    [Surname]: Doe
    [Birthday]: Jan 1st 2000
[Person]: -
`);

/*
    {"Person":{"Name":"John","Surname":"Doe","Birthday":"Jan 1st 2000"}}
*/

Converting JSON data to Bracko data

Bracko.jsonToBracko(`{
    "Person": {
        "Name": "John",
        "Surname": "Doe"
    }
}`);
/*
[Person]:-
[Name]:John
[Surname]:Doe
[Person]:-
*/

Keywords

Bracko

FAQs

Package last updated on 24 Feb 2022

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.