changing apply method name to digest to avoid overriding javascript apply