API for JavaScript validation