Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

syntax-error

Package Overview
Dependencies
Maintainers
1
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

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
949K
decreased by-1.47%
Maintainers
1
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 Feb 2014

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