Simplify statement in shape.js