An open API service indexing awesome lists of open source software.

https://github.com/lggruspe/todo-txt-parser

todo.txt parser for Typescript/javascript
https://github.com/lggruspe/todo-txt-parser

javascript parser todotxt typescript

Last synced: 6 days ago
JSON representation

todo.txt parser for Typescript/javascript

Awesome Lists containing this project

README

          

todo-txt-parser
===============

![GitHub Workflow Status](https://img.shields.io/github/workflow/status/lggruspe/todo-txt-parser/Node.js%20CI)
[![codecov](https://codecov.io/gh/lggruspe/todo-txt-parser/branch/main/graph/badge.svg?token=KICVMONX12)](https://codecov.io/gh/lggruspe/todo-txt-parser)
![npm (scoped)](https://img.shields.io/npm/v/@lggruspe/todo-txt-parser)
![GitHub](https://img.shields.io/github/license/lggruspe/todo-txt-parser)

todo.txt parser for Typescript/Javascript.

Installation
------------

```bash
npm install @lggruspe/todo-txt-parser
```

Usage
-----

```javascript
import { parse } from '@lggruspe/todo-txt-parser'
import { readFileSync } from 'fs'

const todo = readFileSync('todo.txt', 'utf8').trim()
const tasks = parse(todo)
```

Each `Task` contains the following fields.

```typescript
interface Task {
completed?: boolean
priority?: string
completion?: string
creation?: string
description?: string
projects?: Array
contexts?: Array
pairs?: Array<[string, string]>
}
```

See `examples/`.

License
-------

MIT.