mustache / spec

The Mustache spec.
MIT License
366 stars 71 forks source link

Specify how to interpolate null (#101) #123

Closed jgonggrijp closed 3 years ago

jgonggrijp commented 3 years ago

See discussion in #101.

gasche commented 3 years ago

Indeed, interpolating NULL to the empty string reflects the consensus in #101 (among a small group of participants), and is highly consistent (unlike "null") with the following existing parts of the interpolation specification:

If any part fails resolution, the result should be considered falsey, and should interpolate as the empty string. Data should be coerced into a string (and escaped, if appropriate) before interpolation.

I'm in favor of merging this change.

Danappelxx commented 3 years ago

Agreed, seems like an unfortunate oversight. Does anyone know of a Mustache implementation that interpolates null to something other than an empty string? I know it was mentioned in #101 but the poster did not specify which implementation.

As a side note, I think it would be beneficial to add a test for null being falsey.

jgonggrijp commented 3 years ago

As a side note, I think it would be beneficial to add a test for null being falsey.

Oh, right. Shall I add that in here?

Danappelxx commented 3 years ago

I'd consider it a part of "interpolating null", so yeah throw the test case in this pr.

jgonggrijp commented 3 years ago

There you go!

Would you mind to review https://github.com/mustache/mustache/pull/266?

jgonggrijp commented 3 years ago

bump!

Danappelxx commented 3 years ago

Reviewed! Sorry for the delay.

Danappelxx commented 3 years ago

Merged & tagged in v1.2.1

jgonggrijp commented 3 years ago

Thanks!