clux/modul8

data exporting string

Closed this issue · 1 comments

clux commented

Note to self.

There is a string ambiguity which feel a bit off.
This concerns .data().add('key', 'i am a string') vs. .data().add('key', '"i am a string"') + other benefits.

Maybe passing in a string singleton (i.e. the entire key is simply a string) is a non-use case.
In which case:

  • the third parameter to add should be dropped as strings are assumed to contain evaluable javascript.
  • if someone actually wants to export a string directly onto a key, they will have to wrap it in quotes inside a string..
  • require#extensions tests need to be modified to fit this new behaviour

Else, maintain current behaviour:

  • third parameter has to be set to true to export an evaluable javascript string
  • strings can be passed in directly to export a 'singleton' string to a data key.

I think we should change to the former. Because Plugins looked better with it, and because plugins already use first anyway. It will lessen confusion.

clux commented

1 and 2 makes it sensible.