Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mattmezza/email-lang
The email language
https://github.com/mattmezza/email-lang
compiler email language model transpiler
Last synced: 5 days ago
JSON representation
The email language
- Host: GitHub
- URL: https://github.com/mattmezza/email-lang
- Owner: mattmezza
- License: mit
- Created: 2017-02-23T22:34:04.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-02-25T00:48:43.000Z (over 7 years ago)
- Last Synced: 2024-10-11T07:09:48.214Z (27 days ago)
- Topics: compiler, email, language, model, transpiler
- Language: JavaScript
- Size: 19.5 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SYNOPSIS
_A language to model emails._You can use this software in your npm project by requiring it or you can use [email-lang-cli](https://github.com/mattmezza/email-lang-cli) from your command line.
# BUILD
[![Travis](https://img.shields.io/travis/mattmezza/email-lang.svg)]()
```bash
npm install --save-dev email-lang
```# USAGE
### email.txt
Write an email file that follows the language specification```
From: "matteomerola.me"
Subject: Comment about the novel
Date: February 21, 2017 at 7:02:47 AM GMT+1
To: Tiffany
Reply-To: MatteoWe all know the numerous film adaptations of the novel!
Cheers,
Matt.
```### index.js
Create an instance of the model then pass data into it one or more times.```js
const fs = require('fs')
const compile = require('email-lang')let emails = compile(fs.readFileSync('email.txt', 'utf8'))
console.log(emails[0].subject) // prints "Comment about the novel"
```### output
The result will be an array of emails structured as follows
```js
[
{
from: {
name: 'Matteo',
email: '[email protected]'
},
subject: 'The subject of the email',
to: {
name: 'Recipient',
email: '[email protected]'
},
replyTo: {
name: 'Matteo',
email: '[email protected]'
},
text: 'The body content of the email message'
},
{
...// another email if any
}
]
```# LICENSE
http://matteomerola.me
[![License](https://img.shields.io/npm/l/array.from.svg)](/LICENSE)