modeling/src/geometries/geom2/isA.js

  1. /**
  2. * Determine if the given object is a 2D geometry.
  3. * @param {Object} object - the object to interrogate
  4. * @returns {Boolean} true, if the object matches a geom2 based object
  5. * @alias module:modeling/geometries/geom2.isA
  6. */
  7. const isA = (object) => {
  8. if (object && typeof object === 'object') {
  9. if ('sides' in object && 'transforms' in object) {
  10. if (Array.isArray(object.sides) && 'length' in object.transforms) {
  11. return true
  12. }
  13. }
  14. }
  15. return false
  16. }
  17. module.exports = isA