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

defs

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

defs - npm Package Compare versions

Comparing version 0.6.1 to 0.6.2

49

build/es5/defs-main.js

@@ -587,22 +587,43 @@ "use strict";

var gotAST = is.object(src);
if (gotAST && !options.ast) {
return {
errors: ["Can't produce string output when input is an AST. Did you forget to set options.ast = true?"],
var parsed;
if (is.object(src)) {
if (!options.ast) {
return {
errors: [
"Can't produce string output when input is an AST. " +
"Did you forget to set options.ast = true?"
],
};
}
}
var parsed;
try {
parsed = options.parse(src, {
loc: true,
range: true,
});
} catch (e) {
// Received an AST object as src, so no need to parse it.
parsed = src;
} else if (is.string(src)) {
try {
parsed = options.parse(src, {
loc: true,
range: true,
});
} catch (e) {
return {
errors: [
fmt("line {0} column {1}: Error during input file parsing\n{2}\n{3}",
e.lineNumber,
e.column,
src.split("\n")[e.lineNumber - 1],
fmt.repeat(" ", e.column - 1) + "^")
],
};
}
} else {
return {
errors: [fmt("line {0} column {1}: Error during input file parsing\n{2}\n{3}", e.lineNumber, e.column, src.split("\n")[e.lineNumber - 1], fmt.repeat(" ", e.column - 1) + "^")],
errors: ["Input was neither an AST object nor a string."],
};
}
var ast = (gotAST ? src : parsed);
var ast = parsed;
// TODO detect unused variables (never read)

@@ -609,0 +630,0 @@ error.reset();

@@ -0,1 +1,4 @@

## v0.6.2 2013-12-09
* Fix regenerator breakage due to input handling (pr #22)
## v0.6.1 2013-12-09

@@ -2,0 +5,0 @@ * Graceful error handling on malformed source input (issue #18)

@@ -587,22 +587,43 @@ "use strict";

const gotAST = is.object(src);
if (gotAST && !options.ast) {
return {
errors: ["Can't produce string output when input is an AST. Did you forget to set options.ast = true?"],
let parsed;
if (is.object(src)) {
if (!options.ast) {
return {
errors: [
"Can't produce string output when input is an AST. " +
"Did you forget to set options.ast = true?"
],
};
}
}
let parsed;
try {
parsed = options.parse(src, {
loc: true,
range: true,
});
} catch (e) {
// Received an AST object as src, so no need to parse it.
parsed = src;
} else if (is.string(src)) {
try {
parsed = options.parse(src, {
loc: true,
range: true,
});
} catch (e) {
return {
errors: [
fmt("line {0} column {1}: Error during input file parsing\n{2}\n{3}",
e.lineNumber,
e.column,
src.split("\n")[e.lineNumber - 1],
fmt.repeat(" ", e.column - 1) + "^")
],
};
}
} else {
return {
errors: [fmt("line {0} column {1}: Error during input file parsing\n{2}\n{3}", e.lineNumber, e.column, src.split("\n")[e.lineNumber - 1], fmt.repeat(" ", e.column - 1) + "^")],
errors: ["Input was neither an AST object nor a string."],
};
}
const ast = (gotAST ? src : parsed);
const ast = parsed;
// TODO detect unused variables (never read)

@@ -609,0 +630,0 @@ error.reset();

{
"name": "defs",
"version": "0.6.1",
"version": "0.6.2",
"description": "Static scope analysis and transpilation of ES6 block scoped const and let variables, to ES3.",

@@ -5,0 +5,0 @@ "main": "build/es5/defs-main.js",

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