validate-noddity-post
Assert that a Noddity post file can be parsed by the butler, and rendered by Ractive.
Last updated 8 months ago by tehshrike .
WTFPL · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install validate-noddity-post 
SYNC missed versions from official npm registry.

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

Current Tags

  • 3.0.1                                ...           latest (8 months ago)

7 Versions

  • 3.0.1                                ...           8 months ago
  • 3.0.0                                ...           4 years ago
  • 2.0.2                                ...           4 years ago
  • 2.0.1                                ...           4 years ago
  • 2.0.0                                ...           4 years ago
  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 1
Dependencies (1)
Dev Dependencies (7)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |