squint-cljs 0.1.18 → 0.1.20

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.18",
5
+ "version": "0.1.20",
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
 
@@ -1232,3 +1245,60 @@ export function reduce_kv(f, init, m) {
1232
1245
  }
1233
1246
  return ret;
1234
1247
  }
1248
+
1249
+ export function max(x, y, ...more) {
1250
+ if (y == undefined) {
1251
+ return x;
1252
+ }
1253
+ if ( more.length == 0) {
1254
+ return ( x > y ) ? x : y;
1255
+ }
1256
+ return max(max(x,y),...more);
1257
+ }
1258
+
1259
+ export function min(x, y, ...more) {
1260
+ if (y == undefined) {
1261
+ return x;
1262
+ }
1263
+ if ( more.length == 0) {
1264
+ return ( x < y ) ? x : y;
1265
+ }
1266
+ return min(min(x,y),...more);
1267
+ }
1268
+
1269
+ export function map_QMARK_(x) {
1270
+ return (x instanceof Object);
1271
+ }
1272
+
1273
+ export function every_pred(...preds) {
1274
+ return (...args) => {
1275
+ for (let p of preds) {
1276
+ for (let a of args) {
1277
+ let res = p(a);
1278
+ if (!res) {
1279
+ return false;
1280
+ }
1281
+ }
1282
+ }
1283
+ return true;
1284
+ };
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(aseq);
1304
+ }