squint-cljs 0.1.19 → 0.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "squint-cljs",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.1.19",
5
+ "version": "0.1.21",
6
6
  "files": [
7
7
  "core.js",
8
8
  "src/squint/core.js",
@@ -538,6 +538,19 @@ export function map_indexed(f, coll) {
538
538
  return ret;
539
539
  }
540
540
 
541
+ export function keep_indexed(f, coll) {
542
+ let ret = [];
543
+ let i = 0;
544
+ for (const x of iterable(coll)) {
545
+ let fret = f(i, x);
546
+ if (!!fret) {
547
+ ret.push(fret);
548
+ };
549
+ i++;
550
+ }
551
+ return ret;
552
+ }
553
+
541
554
  export function str(...xs) {
542
555
  return xs.join('');
543
556
  }
@@ -1111,7 +1124,7 @@ export class LazySeq {
1111
1124
  this.f = f;
1112
1125
  }
1113
1126
  *[Symbol.iterator]() {
1114
- yield* this.f();
1127
+ yield* iterable(this.f());
1115
1128
  }
1116
1129
  }
1117
1130
 
@@ -1270,3 +1283,22 @@ export function every_pred(...preds) {
1270
1283
  return true;
1271
1284
  };
1272
1285
  }
1286
+
1287
+ export function some_fn(...fns) {
1288
+ return (...args) => {
1289
+ for (let f of fns) {
1290
+ for (let a of args) {
1291
+ let res = f(a);
1292
+ if (!!res) {
1293
+ return res;
1294
+ }
1295
+ }
1296
+ }
1297
+ return undefined;
1298
+ };
1299
+ }
1300
+
1301
+ export function into_array(type, aseq) {
1302
+ let theSeq = aseq || type;
1303
+ return vec(theSeq);
1304
+ }