Update cloth.js

- reduced the type-checking functions to a single type-checking function that uses a lookup table
- minor changes