function getOriginalText(layer, ignoreMetadata) {
  // get data dictionary
  let dataDict = getDataDictionary(layer)

  // get text stored in layer metadata
  // LEGACY: check old 'textWithPlaceholders' key
  let text = dataDict.valueForKey('textWithPlaceholders')
  if (!text) text = dataDict.valueForKey('originalText')

  // set original text if it doesn't exist
  if (ignoreMetadata || !text || !text.length) {
    // get text from text layer
    if (Layers.isLayerText(layer)) {
      text = String(layer.stringValue())
    }

    // get name of artboard
    else if (Layers.isArtboard(layer)) {
      text = String(layer.name())
    }
  }

  return text
}
Gets the original text with placeholders for the layer.

@param {MSTextLayer/MSArtboardGroup} layer
@returns {String}