Skip to content

Commit

Permalink
v0.1.22
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude committed Sep 12, 2023
1 parent f2c7617 commit 13dd4a8
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

[Squint](https://github.com/squint-cljs/squint): ClojureScript syntax to JavaScript compiler

## Unreleased
## 0.1.22

- Fix [#325](https://github.com/squint-cljs/squint/issues/325): fix varargs destructuring
- Fix [#326](https://github.com/squint-cljs/squint/issues/326): bun compatibility

## 0.1.21
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "squint-cljs",
"type": "module",
"sideEffects": false,
"version": "0.1.21",
"version": "0.1.22",
"files": [
"core.js",
"src/squint/core.js",
Expand Down
1 change: 1 addition & 0 deletions resources/squint/core.edn
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
merge
min
neg_QMARK_
next
nil_QMARK_
not
not_any_QMARK_
Expand Down
12 changes: 12 additions & 0 deletions src/squint/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1322,3 +1322,15 @@ export function juxt(...fs) {
return ret;
};
}

export function next(x) {
if (x instanceof Array) {
let ret = x.slice(1);
if (ret.length > 0) {
return ret;
} else {
return null;
}
}
throw new Error('next not implement for non-arrays yet');
}
5 changes: 4 additions & 1 deletion test/squint/compiler_test.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@
(deftest destructure-test
(let [s (jss! "(let [^js {:keys [a b c]} #js {:a 1 :b 2 :c 3}]
(+ a b c))")]
(is (= 6 (js/eval s)))))
(is (= 6 (js/eval s))))
(is (eq #js [1 #js [2 3]]
(jsv! "(let [[x & xs] [1 2 3]]
[x xs])"))))

(deftest fn-test
(let [s (jss! '(let [f (fn [x] x)]
Expand Down

0 comments on commit 13dd4a8

Please sign in to comment.