[JSMODELS-11] Javascript "undefined" value should be treated as null value in freemarker Created: 08/Jun/17  Updated: 23/Jun/17  Resolved: 23/Jun/17

Status: Closed
Project: Magnolia Javascript Models
Component/s: None
Affects Version/s: None
Fix Version/s: 1.0

Type: Improvement Priority: Neutral
Reporter: Jaroslav Simak Assignee: Jaroslav Simak
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:
Sprint: Kromeriz 100
Story Points: 1

 Comments   
Comment by Jaroslav Simak [ 22/Jun/17 ]

rkovarik Reason is was that if you return undefined value in the return statement, it shows as "undefined" in freemarker. It's not treated as null.

Example model:


var Model = function () {
    
    this.returnUndefined = function () {
        var a;
        return a;
    };
    
    this.returnUndefinedInObject = function () {
        var a;
        return {
            "a" : a
        }
    };
    
};

new Model();
Generated at Mon Feb 12 05:58:46 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.