You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@hadaf/syntax

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hadaf/syntax

A library to parse and stringify Hadaf documents

0.0.3
latest
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Hadaf Syntax

A library to parse and stringify Hadaf documents.

The hadaf Syntax

I created the hadaf syntax to make it easy to write and manipulate todo documents. My goal was to have a simple text syntax that is easy to read and write, but also easy to parse and manipulate programmatically. Here is a tour of the syntax:

A document is a list of items

When the following document is parsed:

Implement the hadaf syntax library
Write the tests
Write the documentation

It gives the following result:

[
  {
    "text": "Implement the hadaf syntax library"
  },
  {
    "text": "Write the tests"
  },
  {
    "text": "Write the documentation"
  }
]

Items can have tags

Let add some tags to the tasks:

Implement the hadaf syntax library @project:hadaf.syntax @coding
Write the tests @project:hadaf.syntax @testing @estimation:4h
Write the documentation @project:hadaf.syntax @writing @file:README.md

This will be parsed as:

[
  {
    "text": "Implement the hadaf syntax library",
    "tags": [
      {"name": "project", "type": "text", "value": "hadaf.syntax"},
      {"name": "coding", "type": "boolean", "value": true}
    ]
  },
  {
    "text": "Write the tests",
    "tags": [
      {"name": "project", "type": "text", "value": "hadaf.syntax"},
      {"name": "testing", "type": "boolean", "value": true},
      {"name": "estimation", "type": "duration", "value": 240}
    ]
  },
  {
    "text": "Write the documentation",
    "tags": [
      {"name": "project", "type": "text", "value": "hadaf.syntax"},
      {"name": "writing", "type": "boolean", "value": true},
      {"name": "file", "type": "text", "value": "README.md"}
    ]
  }
]

Items can have sub-items

Let's add some sub-items to the first tasks:

Implement the hadaf syntax library @project:hadaf.syntax @coding
  Write the `parse` function @estimation:2h
  Write the `stringify` function @estimation:2h

This will be parsed as:

[
  {
    "text": "Implement the hadaf syntax library",
    "tags": [
      {"name": "project", "type": "text", "value": "hadaf.syntax"},
      {"name": "coding", "type": "boolean", "value": true}
    ],
    "items": [
      {
        "text": "Write the `parse` function",
        "tags": [
          {"name": "estimation", "type": "duration", "value": 120}
        ]
      },
      {
        "text": "Write the `stringify` function",
        "tags": [
          {"name": "estimation", "type": "duration", "value": 120}
        ]
      }
    ]
  }
]

Items can have a title

We can add a prefix to the item's text followed by a colon to make it a title, which is useful when combined with sub-items:

hadaf.syntax: @open-source
  Implement the hadaf syntax library
  Write the tests
  Write the documentation

This will be parsed as:

[
  {
    "title": "hadaf.syntax",
    "tags": [
      {"name": "open-source", "type": "boolean", "value": true}
    ],
    "items": [
      {
        "text": "Implement the hadaf syntax library"
      },
      {
        "text": "Write the tests"
      },
      {
        "text": "Write the documentation"
      }
    ]
  }
]

Supported tag types and values

  • boolean: @flag, @unwanted:false, @wanted:true
  • number: @integer:123, @double:123.45
  • duration: @duration-minutes:15m, @duration-hours:5h, @duration-both:2h15m
  • date: @date:25/03/2024, @time:14h05, @datetime:15/07/2024_11h45
  • list: @items:foo,bar,baz
  • text: Any other format is considered text, like @project:hadaf.syntax, @file:README.md

FAQs

Package last updated on 28 Apr 2024

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.