Scripting Engine

Learn about our server-side JavaScript engine.

Stacklane uses a JavaScript subset for server-side logic. This subset is designed for speed, security, and compile time validation. The primary uses are endpoints and suppliers.

The JS engine implies "use strict" by default, however its strictness goes beyond this standard setting. In general Stacklane will not a let a script successfully compile unless it can validate all properties and methods referenced actually exist. This is particularly helpful when it comes to referencing data models.

Restrictions

The following is not an exhaustive list, but covers common cases:

  • Use let instead of var.
  • Compact function syntax only -- instead of function (..) {..}, use the equivalent compact syntax (..)=>{..}
  • Date objects are immutable -- any of the Date.setXyz methods are not available.
  • const is not supported.
  • Free-form iteration via for or while is not allowed. Instead, where cases that require working on items in bulk, special case callback methods are provided.
  • Once assigned, variables may not change their type -- this works let x = null; x = '1' (null to string), but this does not let x = 1; x = '1' (number to string).