{
  "name": "utils",
  "description": "Utility functions",
  "dependencies": [
    "three"
  ],
  "devDependencies": [
    "@types/three"
  ],
  "registryDependencies": [
    "create-material"
  ],
  "files": [
    {
      "path": "utils.ts",
      "content": "import type { Material } from \"@3dvf/create-material/material\";\nimport type { AnimationClip, Mesh, Object3D } from \"three\";\n\nexport function assertIsMesh(value: any): asserts value is Mesh {\n  if (value?.type !== 'Mesh') {\n    throw Error('value is not a mesh')\n  }\n}\n\nexport function getAllChildMesh(object: Object3D): Mesh[] {\n  const meshes: Mesh[] = [];\n  object.traverse((child: Object3D) => {\n    if (child.type !== 'Mesh') {\n      return\n    }\n    assertIsMesh(child);\n    meshes.push(child)\n  })\n  \n  return meshes;\n}\n\nexport function assertIsMaterial(value: any): asserts value is Material {\n  if (!value?.isMaterial) {\n    throw Error('value is not a material')\n  }\n}\n\nexport function assertIsClip(value: any): asserts value is AnimationClip {\n  if (!value) {\n    throw Error('value is not a clip')\n  }\n}\n\nexport function assertIsNotNullish<T>(value: T | null | undefined): asserts value is T {\n  if (value === undefined || value === null) {\n    throw Error('value is nullish');\n  }\n}\n"
    }
  ]
}