Permalink
Browse files

Some adjustments/refactoring to '='.

  • Loading branch information...
1 parent b481f4c commit b15133f6b52484a4c0c37ab62aa6678cefb0b230 @stighenriksen stighenriksen committed May 7, 2012
Showing with 9 additions and 6 deletions.
  1. +9 −6 src/clojure/core.misc.js
View
@@ -15,13 +15,16 @@ exports['='] = function equals() {
form = args[i];
nextForm = args[i + 1];
- // Do 'simple' check if form is string, number or keyword
- if ((form.kind === string.kind ||
- form.kind === number.kind ||
- form.kind === keyword.kind) &&
- (form.kind !== nextForm.kind ||
- form.value !== nextForm.value)){
+ var stringNumOrKeyword = function(form) {
+ return (form.kind === string.kind ||
+ form.kind === number.kind ||
+ form.kind === keyword.kind);
+ };
+ if (stringNumOrKeyword(form) || stringNumOrKeyword(nextForm)){
+ if (form.kind !== nextForm.kind ||
+ form.value !== nextForm.value){
return literal(false);
+ }
}
else if (form.value.length !== nextForm.value.length){
return literal(false);

0 comments on commit b15133f

Please sign in to comment.