Skip to content

LambdaContext lookup should return null if no property #44

Description

@luaVolk

Let's say i have something like this

{{!index.mustache}}

{{#users}}
...
{{#isBirthday}}
HAPPY BIRTHDAY!!!
{{/isBirthday}}
...
{{/users}}
// app.dart
...

template.render({
  'users': [
    {
      'name': 'guy',
      'age': 18,
      'birthday': {'day': 15, 'month': 5},
    },
    {
      'name': 'gal',
      'age': 22,
    }
  ],
  'isBirthday': (LambdaContext ctx) {
    Map birthday = ctx.lookup('birthday'); // Causes an error because it returns an empty Object on the second person

    if (birthday != null) {
      ...
    }
  }
}, req.response)


...

Wouldn't it make more sense to return null since that's what it actually is?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions