generalize = (options, ...geometries) => {
  geometries = flatten(geometries)
  if (geometries.length === 0) throw new Error('wrong number of arguments')

  const results = geometries.map((geometry) => {
    if (path2.isA(geometry)) return generalizePath2(options, geometry)
    if (geom2.isA(geometry)) return generalizeGeom2(options, geometry)
    if (geom3.isA(geometry)) return generalizeGeom3(options, geometry)
    throw new Error('invalid geometry')
  })
  return results.length === 1 ? results[0] : results
}
Apply various modifications in proper order to produce a generalized geometry.
@param {Object} options - options for modifications
@param {Boolean} [options.snap=false] the geometries should be snapped to epsilons
@param {Boolean} [options.simplify=false] the geometries should be simplified
@param {Boolean} [options.triangulate=false] the geometries should be triangulated
@param {...Object} geometries - the geometries to generalize
@return {Object|Array} the modified geometry, or a list of modified geometries
@alias module:modeling/modifiers.generalize