lodash-template-validator

0.1.1 • Public • Published

lodash-template-validator NPM version Build Status Coverage Status

Shows you, where the error is in your lodash-template

Example

var validate = require('lodash-template-validator')
try {
  validate('<% abc %>\n<%= ce.sd.<d %>')
} catch (e) {
  console.log(e)
// { [SyntaxError: Unexpected token (2:11)] loc: { column: 11, line: 2 }, pos: 20 }
}

API

validate

Validates a template and throws an error if there are any syntax errors. The error will contain the exact location of the error within the template. (As far as that is possible).

Params

  • string {string}: the template string

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

see CONTRIBUTING.md

Changelog

see CHANGELOG.md

Author

Nils Knappmeier

License

Released under the MIT license.

Readme

Keywords

none

Package Sidebar

Install

npm i lodash-template-validator

Weekly Downloads

4

Version

0.1.1

License

MIT

Last publish

Collaborators

  • knappi