validate-noddity-post

3.0.1 • Public • Published

Validate noddity posts so that you can be guaranteed that their metadata is valid/parseable, and the contents can be rendered by the templating engine.

API

Greenkeeper badge

const Validator = require('validate-noddity-post')
const validate = Validator({
    butler,
    linkifier,
    data
})

require returns a constructor function:

constructor({ butler, linkifier, data, [template] })

The constructor function returns a validator function:

validator function(post)

Returns a promise that resolves with an object. If there is anything wrong with the post it will have an error property.

If the promise is rejected, then something is wrong with the universe, which is a distinct possibility when you're interacting with physical disks and internets and whatnot.

Example

validate('my-newest-post.md').then(({ error }) => {
    if (error) {
        console.log('your post sucks!', error)
    }
})

License

WTFPL

Readme

Keywords

Package Sidebar

Install

npm i validate-noddity-post

Weekly Downloads

14

Version

3.0.1

License

WTFPL

Unpacked Size

6.99 kB

Total Files

9

Last publish

Collaborators

  • tehshrike