templateSettings.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import escape from './escape.js';
  2. import reEscape from './_reEscape.js';
  3. import reEvaluate from './_reEvaluate.js';
  4. import reInterpolate from './_reInterpolate.js';
  5. /**
  6. * By default, the template delimiters used by lodash are like those in
  7. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  8. * following template settings to use alternative delimiters.
  9. *
  10. * **Security:** See
  11. * [threat model](https://github.com/lodash/lodash/blob/main/threat-model.md)
  12. * — `_.template` is insecure and will be removed in v5.
  13. *
  14. * @static
  15. * @memberOf _
  16. * @type {Object}
  17. */
  18. var templateSettings = {
  19. /**
  20. * Used to detect `data` property values to be HTML-escaped.
  21. *
  22. * @memberOf _.templateSettings
  23. * @type {RegExp}
  24. */
  25. 'escape': reEscape,
  26. /**
  27. * Used to detect code to be evaluated.
  28. *
  29. * @memberOf _.templateSettings
  30. * @type {RegExp}
  31. */
  32. 'evaluate': reEvaluate,
  33. /**
  34. * Used to detect `data` property values to inject.
  35. *
  36. * @memberOf _.templateSettings
  37. * @type {RegExp}
  38. */
  39. 'interpolate': reInterpolate,
  40. /**
  41. * Used to reference the data object in the template text.
  42. *
  43. * @memberOf _.templateSettings
  44. * @type {string}
  45. */
  46. 'variable': '',
  47. /**
  48. * Used to import variables into the compiled template.
  49. *
  50. * @memberOf _.templateSettings
  51. * @type {Object}
  52. */
  53. 'imports': {
  54. /**
  55. * A reference to the `lodash` function.
  56. *
  57. * @memberOf _.templateSettings.imports
  58. * @type {Function}
  59. */
  60. '_': { 'escape': escape }
  61. }
  62. };
  63. export default templateSettings;