3

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
  • 100,619
  • 31
  • 269
  • 393
Bayernzc
  • 43
  • 4

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
  • 100,619
  • 31
  • 269
  • 393
Jack Bashford
  • 43,180
  • 11
  • 50
  • 79
  • 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