Skip to content
  • Rob Swindell's avatar
    4914fa1d
    Global JS function parameter validation and updated return types · 4914fa1d
    Rob Swindell authored
    Many global functions now throw an exception when null or undefined is passed
    as a required parameter where null or undefined makes no sense.
    e.g. "Argument #1 is an unexpected 'null' or 'undefined' value"
    Example exception: is-a/has-a type functions will still return false when
    passed null or undefined.
    
    Changed global function return types:
    - write() now always returns undefined
    - printf() always returns a string, never undefined or garbage string
    - prompt() returns null (not undefined) upon no input (as documented)
    
    sbbs works more like jsexec:
    - read(0) now returns an empty string instead of undefined
    - readln(0) no longer waits for enter
    
    jsexec works more like sbbs:
    - add missing write_raw() global function, alias for write()
    
    Include expected number of argment in "Insufficient Arguments" exception
    message.
    
    Update JSDOCS for some global methods:
    - file_chmod returns boolean, not number
    - flags_str requires a minimum of one argument
    
    New tests to validate expected exceptions and return types based on usage.
    4914fa1d
    Global JS function parameter validation and updated return types
    Rob Swindell authored
    Many global functions now throw an exception when null or undefined is passed
    as a required parameter where null or undefined makes no sense.
    e.g. "Argument #1 is an unexpected 'null' or 'undefined' value"
    Example exception: is-a/has-a type functions will still return false when
    passed null or undefined.
    
    Changed global function return types:
    - write() now always returns undefined
    - printf() always returns a string, never undefined or garbage string
    - prompt() returns null (not undefined) upon no input (as documented)
    
    sbbs works more like jsexec:
    - read(0) now returns an empty string instead of undefined
    - readln(0) no longer waits for enter
    
    jsexec works more like sbbs:
    - add missing write_raw() global function, alias for write()
    
    Include expected number of argment in "Insufficient Arguments" exception
    message.
    
    Update JSDOCS for some global methods:
    - file_chmod returns boolean, not number
    - flags_str requires a minimum of one argument
    
    New tests to validate expected exceptions and return types based on usage.
Loading