static convert()

in src/lib/components/molecules/canvas-map/lib/util/extent.js [84:100]


  static convert(input) {
    if (input instanceof Extent) return input
    if (!input) return null

    if (Array.isArray(input) && input.length === 4) {
      const [minX, minY, maxX, maxY] = input
      return new Extent(minX, minY, maxX, maxY)
    } else if (Array.isArray(input) && input.length === 2) {
      const [min, max] = input
      return new Extent(min[0], min[1], max[0], max[1])
    } else if (typeof input === "object" && input !== null) {
      const { minX, minY, maxX, maxY } = input
      return new Extent(minX, minY, maxX, maxY)
    }

    throw new Error("`input` argument must be of type `ExtentLike`")
  }