2

I'm reading a js file for transforming of one spatial model(.gml). from a specific projection to another. What does ":::" mean in the code as follows?

_getTransformation(projectionFrom, projectionTo) {
    let cacheKey = `${projectionFrom}:::${projectionTo}`;
    if (!this.transformations[cacheKey]) {
      let from = this._getProjection(projectionFrom);
      let to = this._getProjection(projectionTo);
      this.transformations[cacheKey] = proj4(from, to);
    }
    return this.transformations[cacheKey];
}
gman
  • 92,182
  • 29
  • 231
  • 348
Bayernzc
  • 23
  • 3

1 Answers1

2

The string with ` is called a template literal, it's an ES6 string making multiple lines and interpolation easier. The ::: is just a collection of three characters in the string. It's equivalent to:

let cacheKey = projectionFrom + ":::" + projectionTo;

No special characters involved bar the ${} - that signifies that the contents should be treated like an expression, the result of which is inserted into the string.

gman
  • 92,182
  • 29
  • 231
  • 348
Jack Bashford
  • 40,575
  • 10
  • 44
  • 74
  • No worries @Bayernzc, always glad to help. If my answer fixed your problem, please mark it as accepted by clicking the grey tick mark to the left of my answer. – Jack Bashford Aug 14 '19 at 03:34