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

raz

Package Overview
Dependencies
Maintainers
1
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

raz - npm Package Compare versions

Comparing version 0.0.73 to 0.0.74

3

core/parser.js

@@ -1134,3 +1134,4 @@ 'use strict';

else if (ch === '<') {
if (lastLiteral === '' || lastLiteral === '{' || lastLiteral === ';') {
// ':' for `switch/case:`
if (lastLiteral === '' || lastLiteral === '{' || lastLiteral === ';' || lastLiteral === ':') {
this.stepBack(blocks, 0);

@@ -1137,0 +1138,0 @@ this.parseHtmlInsideCode(blocks);

@@ -66,8 +66,7 @@ [<< Back to start](../README.md)

<a name="handleErrors"></a>
### handleErrors(app, errorCode, mode)
### handleErrors(app, errorCode)
* **app** `<express>` instance of the Express app
* **errorCode** `<integer>`, *default:* 500
* **mode** `<String>`, *default:* "development"
Sets the engine's built-in error handler, after which all Razor-Express errors will be converted to the HTML format with the specified error code. This handler will work only if the mode specified in the `mode` parameter matches the value of the `NODE_ENV` environment variable.
Sets the engine's built-in error handler, after which all Razor-Express errors will be converted to the HTML format with the specified error code. This handler will work only if the `NODE_ENV` environment variable is not equal to *"production"*.
```js

@@ -74,0 +73,0 @@ const app = require('express')(); // the Express web server app

@@ -56,3 +56,3 @@ [<< Back to start](../README.md)

By default `errorCode` is `500` and `mode` is `"development"`. This means that by default you'll get an HTML-formatted error and HTTP response with code 500 only if the `NODE_ENV` environment variable has a value equal to `"development"` ([express](https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production), [stackoverflow](https://stackoverflow.com/a/16979503/1844247)). If the `NODE_ENV` variable is not set at all then it's considered (by the Express) to be `"development"` by default.
By default `errorCode` is `500`. This means that by default you'll get an HTML-formatted error and HTTP response with code 500 only if the `NODE_ENV` environment variable has a value not equal to `"production"` ([express](https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production), [stackoverflow](https://stackoverflow.com/a/16979503/1844247)). If the `NODE_ENV` variable is not set at all then it's considered (by the Express) to be `"development"` by default.

@@ -73,3 +73,3 @@

if (env === "development" && err.name == "RazorError") {
if (env !== "production" && err.name == "RazorError") {
var errorHtml = err.html();

@@ -76,0 +76,0 @@ res.status(500);

{
"name": "raz",
"description": "Razor-like Template Engine for NodeJS Express library based on ASP.NET MVC Razor syntax. Template your views by mixing HTML markup with JavaScript server-side code!",
"version": "0.0.73",
"version": "0.0.74",
"author": {

@@ -6,0 +6,0 @@ "name": "Sergey Fisun",

@@ -705,2 +705,24 @@ (function () {

template: `
@{
var n = 3;
}
@switch(n) {
case 1:
<div>one</div>
break;
case 2:
<div>two</div>
break;
case 3:
<div>three</div>
break;
default:
<div>--error--</div>
break;
}`,
expected: `\n <div>three</div>\n`
},
{
name: "Code 70",
template: `
@{

@@ -707,0 +729,0 @@ var s = "12'3'45";

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