code: function layerContainsImage (layer, imageUrl) {
    // Check the layer itself.
    if (layer.type === 'image' && layer.imageUrl === imageUrl) {
      return layer;
    }
  
    // Check the layer's children.
    if (layer.children) {
      for (var i=0, len=layer.children.length; i < len; i++) {
        if (layerContainsImage(layer.children[i], imageUrl)) {
          return layer.children[i];
        }
      }
    }
  
    return false;
  }
docs: Check if a layer is using a given image URL.
  
  @param {RenderLayer} layer
  @param {String} imageUrl
  @return {Boolean}