Socket
Socket
Sign inDemoInstall

syntax-error

Package Overview
Dependencies
Maintainers
3
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

syntax-error

detect and report syntax errors in source code strings


Version published
Weekly downloads
1.1M
decreased by-0.97%
Maintainers
3
Weekly downloads
 
Created

What is syntax-error?

The syntax-error npm package is used to check JavaScript code for syntax errors. It can be used as a module in Node.js to detect and report syntax errors in code strings.

What are syntax-error's main functionalities?

Check for syntax errors in a string of code

This feature allows you to pass a string of JavaScript code and optionally a filename, and it will return an error object if there are syntax errors in the code. If there are no syntax errors, it returns undefined.

const syntaxError = require('syntax-error');
const src = 'var foo = 1;
var bar = ;';
const err = syntaxError(src, 'foo.js');
if (err) console.error('Error:', err);

Other packages similar to syntax-error

Keywords

FAQs

Package last updated on 01 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc