pepka 0.12.2 → 0.13.0-b1

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.
@@ -1,4 +1,4 @@
1
- const __ = (function Placeholder() { });
1
+ const __ = Symbol('Placeholder');
2
2
  const countArgs = (s) => {
3
3
  let i = 0;
4
4
  for (const v of s)
@@ -37,7 +37,38 @@ const _curry = (fn, args, new_args) => {
37
37
  };
38
38
  const curry = ((fn) => ((...args) => fn.length > countArgs(args)
39
39
  ? _curry(fn, [], args)
40
- : fn(...args)));
40
+ : fn(...args)));
41
+ // type EndlessPh<Func extends FT.Function, ArgT> =
42
+ // (a: ArgT) => ReturnType<Func>
43
+ // | ((a: A.x) => EndlessPh<Func, ArgT>)
44
+ const endlessph = (fn) => {
45
+ function _endlessph(a) {
46
+ return a === __ ? fn : fn(a);
47
+ }
48
+ return _endlessph;
49
+ };
50
+ function curry2(fn) {
51
+ function curried2(a, b) {
52
+ const withPlaceholder1 = a === __;
53
+ const aln = arguments.length;
54
+ if (aln === 1 && withPlaceholder1)
55
+ throw new Error('Senseless placeholder usage.');
56
+ return arguments.length > 1
57
+ ? withPlaceholder1
58
+ ? endlessph((a) => fn(a, b))
59
+ : fn(a, b)
60
+ : (b) => fn(a, b);
61
+ }
62
+ return curried2;
63
+ }
64
+ function curry3(fn) {
65
+ // type p0 = Parameters<Func>[0]
66
+ // type p1 = Parameters<Func>[1]
67
+ // type p2 = Parameters<Func>[2]
68
+ // type ReturnT = ReturnType<Func>
69
+ // TODO: optimize.
70
+ return curry(fn);
71
+ }
41
72
 
42
73
  const undef = undefined;
43
74
  const nul = null;
@@ -63,14 +94,14 @@ const type = (s) => {
63
94
  : caseMap[t[0]] + t.slice(1);
64
95
  };
65
96
 
66
- const qappend = curry((s, xs) => { xs.push(s); return xs; });
67
- const qassoc = curry((prop, v, obj) => {
97
+ const qappend = curry2((s, xs) => { xs.push(s); return xs; });
98
+ const qassoc = curry3((prop, v, obj) => {
68
99
  obj[prop] = v;
69
100
  return obj;
70
101
  });
71
- const qreduce = curry((fn, accum, arr) => arr.reduce(fn, accum));
102
+ const qreduce = curry3((fn, accum, arr) => arr.reduce(fn, accum));
72
103
  // strategy is for arrays: 1->clean, 2->merge, 3->push.
73
- const mergeDeep = curry((strategy, o1, o2) => {
104
+ const mergeDeep$1 = curry3((strategy, o1, o2) => {
74
105
  for (let k in o2) {
75
106
  switch (type(o2[k])) {
76
107
  case 'Array':
@@ -80,7 +111,7 @@ const mergeDeep = curry((strategy, o1, o2) => {
80
111
  const o1k = o1[k], o2k = o2[k];
81
112
  for (const i in o2k) {
82
113
  if (o1k[i]) {
83
- mergeDeep(strategy, o1k[i], o2k[i]);
114
+ mergeDeep$1(strategy, o1k[i], o2k[i]);
84
115
  }
85
116
  else {
86
117
  o1k[i] = o2k[i];
@@ -96,7 +127,7 @@ const mergeDeep = curry((strategy, o1, o2) => {
96
127
  break;
97
128
  case 'Object':
98
129
  if (type(o1[k]) === 'Object') {
99
- mergeDeep(strategy, o1[k], o2[k]);
130
+ mergeDeep$1(strategy, o1[k], o2[k]);
100
131
  break;
101
132
  }
102
133
  default:
@@ -106,11 +137,11 @@ const mergeDeep = curry((strategy, o1, o2) => {
106
137
  }
107
138
  return o1;
108
139
  });
109
- const qmergeDeep = mergeDeep(1);
110
- const qmergeDeepX = mergeDeep(2);
111
- const qmergeDeepAdd = mergeDeep(3);
140
+ const qmergeDeep = mergeDeep$1(1);
141
+ const qmergeDeepX = mergeDeep$1(2);
142
+ const qmergeDeepAdd = mergeDeep$1(3);
112
143
  /** qmapKeys({ a: 'b' }, { a: 44 }) -> { b: 44 } */
113
- const qmapKeys = curry((keyMap, o) => {
144
+ const qmapKeys = curry2((keyMap, o) => {
114
145
  let k, mapped, newKey, newValue;
115
146
  for (k in keyMap) {
116
147
  mapped = keyMap[k];
@@ -124,7 +155,7 @@ const qmapKeys = curry((keyMap, o) => {
124
155
  }
125
156
  return o;
126
157
  });
127
- const qfilter = curry((cond, data) => {
158
+ const qfilter = curry2((cond, data) => {
128
159
  const isArr = isArray(data);
129
160
  for (let k in data) {
130
161
  if (!cond(data[k], k)) {
@@ -139,10 +170,14 @@ const qfilter = curry((cond, data) => {
139
170
  }
140
171
  return data;
141
172
  });
142
- const qindexOf = curry((x, xs) => xs.indexOf(x));
173
+ /** @deprecated */
174
+ const qindexOf = curry2((x, xs) => xs.indexOf(x));
175
+
176
+ // TODO: possibly introduce a second argument limiting unfolding.
177
+ const uncurry = (fn) => (...args) => qreduce(((fn, arg) => fn ? fn(arg) : fn), fn, args);
143
178
 
144
179
  // over, lensProp
145
- const equals = curry((a, b) => {
180
+ const equals = curry2((a, b) => {
146
181
  const typea = type(a);
147
182
  if (typea === type(b) && (typea === 'Object' || typea == 'Array')) {
148
183
  if (isNull(a) || isNull(b)) {
@@ -164,16 +199,17 @@ const equals = curry((a, b) => {
164
199
  return a === b;
165
200
  });
166
201
  const ifElse = curry((cond, pipeYes, pipeNo, s) => cond(s) ? pipeYes(s) : pipeNo(s));
167
- const when = curry((cond, pipe, s) => ifElse(cond, pipe, identity, s));
202
+ const when = curry3((cond, pipe, s) => ifElse(cond, pipe, identity, s));
168
203
  const compose = ((...fns) => (s = __) => {
169
204
  for (let i = length(fns) - 1; i > -1; i--) {
170
205
  s = s === __ ? fns[i]() : fns[i](s);
171
206
  }
172
207
  return s;
173
- }); // as F.Compose
174
- const bind = curry((fn, context) => fn.bind(context));
175
- const nth = curry((i, data) => data[i]);
176
- const includes = curry((s, ss) => {
208
+ });
209
+ const bind = curry2((fn, context) => fn.bind(context));
210
+ const _nth = (i, data) => data[i];
211
+ const nth = curry2(_nth);
212
+ const includes = curry2((s, ss) => {
177
213
  if (isStr(ss)) {
178
214
  return ss.includes(s);
179
215
  }
@@ -186,11 +222,11 @@ const includes = curry((s, ss) => {
186
222
  return false;
187
223
  }
188
224
  });
189
- const slice = curry((from, to, o) => o.slice(from, (isNum(to) ? to : Infinity)));
225
+ const slice = curry3((from, to, o) => o.slice(from, (isNum(to) ? to : Infinity)));
190
226
  const head = nth(0);
191
227
  const tail = slice(1, nul);
192
- const add = curry((n, m) => n + m);
193
- const subtract = curry((n, m) => m - n);
228
+ const add = curry2((n, m) => n + m);
229
+ const subtract = curry2((n, m) => m - n);
194
230
  const flip = (fn) => curry((b, a) => fn(a, b));
195
231
  const isNil = (s) => isNull(s) || isUndef(s);
196
232
  const length = (s) => s.length;
@@ -206,10 +242,10 @@ const complement = (fn) => (...args) => {
206
242
  const keys = (o) => Object.keys(o);
207
243
  const values = (o) => Object.values(o);
208
244
  const toPairs = (o) => Object.entries(o);
209
- const test = curry((re, s) => re.test(s));
210
- const tap = curry((fn, s) => { fn(s); return s; });
211
- const append = curry((s, xs) => [...xs, s]);
212
- const split = curry((s, xs) => xs.split(s));
245
+ const test = curry2((re, s) => re.test(s));
246
+ const tap = curry2((fn, s) => { fn(s); return s; });
247
+ const append = curry2((s, xs) => [...xs, s]);
248
+ const split = curry2((s, xs) => xs.split(s));
213
249
  const T = always(true);
214
250
  const F = always(false);
215
251
  const sizeof = (s) => {
@@ -222,10 +258,10 @@ const sizeof = (s) => {
222
258
  else
223
259
  return length(s);
224
260
  };
225
- const range = curry((from, to) => genBy(add(from), to - from));
261
+ const range = curry2((from, to) => genBy(add(from), to - from));
226
262
  const uniq = (xs) => qreduce((accum, x) => includes(x, accum) ? accum : qappend(x, accum), [], xs);
227
- const intersection = curry((xs1, xs2) => xs1.filter(flip(includes)(xs2)));
228
- const genBy = curry((generator, length) => [...Array(length)].map((_, i) => generator(i)));
263
+ const intersection = curry2((xs1, xs2) => xs1.filter(flip(includes)(xs2)));
264
+ const genBy = curry2((generator, length) => [...Array(length)].map((_, i) => generator(i)));
229
265
  const once = (fn) => {
230
266
  let done = false, cache;
231
267
  return (...args) => {
@@ -239,50 +275,51 @@ const once = (fn) => {
239
275
  };
240
276
  };
241
277
  const reverse = (xs) => compose((ln) => reduce((nxs, _, i) => qappend(xs[ln - i], nxs), [], xs), add(-1), length)(xs);
242
- const gt = curry((a, b) => a > b);
243
- const lt = curry((a, b) => a < b);
244
- const gte = curry((a, b) => b >= a);
245
- const lte = curry((a, b) => b <= a);
246
- // : <U=any>(sortFn: (v: U)=>-1|1, xs: U[]) => U[]
247
- const sort = curry((sortFn, xs) => xs.sort(sortFn));
248
- const find = curry((fn, s) => s.find(fn));
249
- const findIndex = curry((fn, s) => s.findIndex(fn));
250
- const indexOf = curry((x, xs) => findIndex(equals(x), xs));
278
+ const gt = curry2((a, b) => a > b);
279
+ const lt = curry2((a, b) => a < b);
280
+ const gte = curry2((a, b) => b >= a);
281
+ const lte = curry2((a, b) => b <= a);
282
+ const sort = curry2((sortFn, xs) => xs.sort(sortFn));
283
+ const find = curry2((fn, s) => s.find(fn));
284
+ const findIndex = curry2((fn, s) => s.findIndex(fn));
285
+ const indexOf = curry2((x, xs) => findIndex(equals(x), xs));
251
286
  const explore = (caption, level = 'log') => tap((v) => console[level](caption, v));
252
- const cond = curry((pairs, s) => {
287
+ const cond = curry2((pairs, s) => {
253
288
  for (const [cond, fn] of pairs) {
254
289
  if (cond(s)) {
255
290
  return fn(s);
256
291
  }
257
292
  }
258
293
  });
259
- const assoc = curry((prop, v, obj) => ({
294
+ const assoc = curry3((prop, v, obj) => ({
260
295
  ...obj,
261
296
  [prop]: v
262
297
  }));
263
- const assocPath = curry((_path, v, o) => compose((first) => assoc(first, length(_path) < 2
298
+ const assocPath = curry3((_path, v, o) => compose((first) => assoc(first, length(_path) < 2
264
299
  ? v
265
300
  : assocPath(slice(1, null, _path), v, isObj(o[first]) ? o[first] : {}), o), head)(_path));
266
- const all = curry((pred, xs) => xs.every(pred));
267
- const any = curry((pred, xs) => xs.some(pred));
268
- const allPass = curry((preds, x) => preds.every((pred) => pred(x)));
269
- const anyPass = curry((preds, x) => preds.some((pred) => pred(x)));
270
- const prop = curry((key, o) => o[key]);
271
- const propEq = curry((key, value, o) => equals(o[key], value));
272
- const propsEq = curry((key, o1, o2) => equals(o1[key], o2[key]));
273
- const pathOr = curry((_default, path, o) => ifElse(length, () => isNil(o)
301
+ const all = curry2((pred, xs) => xs.every(pred));
302
+ const any = curry2((pred, xs) => xs.some(pred));
303
+ const allPass = curry2((preds, x) => preds.every((pred) => pred(x)));
304
+ const anyPass = curry2((preds, x) => preds.some((pred) => pred(x)));
305
+ const prop = curry2((key, o) => o[key]);
306
+ const propEq = curry3((key, value, o) => equals(o[key], value));
307
+ const propsEq = curry3((key, o1, o2) => equals(o1[key], o2[key]));
308
+ const pathOr = curry3((_default, path, o) => ifElse(length, () => isNil(o)
274
309
  ? _default
275
310
  : compose(ifElse(isNil, always(_default), (o) => pathOr(_default, slice(1, nul, path), o)), flip(prop)(o), head)(path), always(o), path));
276
311
  const path = pathOr(undef);
277
- const pathEq = curry((_path, value, o) => equals(path(_path, o), value));
278
- const pathsEq = curry((_path, o1, o2) => equals(path(_path, o1), path(_path, o2)));
312
+ const pathEq = curry3((_path, value, o) => equals(path(_path, o), value));
313
+ const pathsEq = curry3((_path, o1, o2) => equals(path(_path, o1), path(_path, o2)));
279
314
  const typed_arr_re = /^(.*?)(8|16|32|64)(Clamped)?Array$/;
280
- const clone = (s) => {
315
+ const clone = (s, shallow = false) => {
281
316
  const t = type(s);
282
317
  switch (t) {
283
318
  case 'Null': return s;
284
- case 'Array': return map(clone, s);
319
+ case 'Array': return shallow ? [...s] : map(clone, s);
285
320
  case 'Object':
321
+ if (shallow)
322
+ return { ...s };
286
323
  const out = {};
287
324
  for (let k in s) {
288
325
  out[k] = clone(s[k]);
@@ -294,12 +331,13 @@ const clone = (s) => {
294
331
  case 'Symbol':
295
332
  return s;
296
333
  default:
297
- return typed_arr_re.test(t) ? map(clone, s) : s;
334
+ return typed_arr_re.test(t) ? s.constructor.from(s) : s;
298
335
  }
299
336
  };
300
- const reduce = curry((fn, accum, arr) => qreduce(fn, clone(accum), arr));
301
- const pickBy = curry((cond, o) => filter(cond, o));
302
- const pick = curry((props, o) => {
337
+ const cloneShallow = (s) => clone(s, true);
338
+ const reduce = curry3((fn, accum, arr) => qreduce(fn, clone(accum), arr));
339
+ const pickBy = curry2((cond, o) => filter(cond, o));
340
+ const pick = curry2((props, o) => {
303
341
  const out = {};
304
342
  for (const p of props) {
305
343
  if (p in o) {
@@ -308,13 +346,13 @@ const pick = curry((props, o) => {
308
346
  }
309
347
  return out;
310
348
  });
311
- const omit = curry((props, o) => filter((_, k) => !includes(k, props), o));
349
+ const omit = curry2((props, o) => filter((_, k) => !includes(k, props), o));
312
350
  const fromPairs = (pairs) => reduce((o, pair) => assoc(...pair, o), {}, pairs);
313
- const concat = curry(((a, b) => a.concat(b)));
314
- const join = curry((delimeter, arr) => arr.join(delimeter));
315
- const map = curry((pipe, arr) => arr.map(pipe));
316
- const forEach = curry((pipe, arr) => arr.forEach(pipe));
317
- const both = curry((cond1, cond2, s) => cond2(s) && cond1(s));
351
+ const concat = curry2(((a, b) => a.concat(b)));
352
+ const join = curry2((delimeter, arr) => arr.join(delimeter));
353
+ const map = curry2((pipe, arr) => arr.map(pipe));
354
+ const forEach = curry2((pipe, arr) => arr.forEach(pipe));
355
+ const both = curry3((cond1, cond2, s) => cond2(s) && cond1(s));
318
356
  const isEmpty = (s) => {
319
357
  switch (type(s)) {
320
358
  case 'String':
@@ -334,8 +372,8 @@ const empty = (s) => {
334
372
  default: return undef;
335
373
  }
336
374
  };
337
- const replace = curry((a, b, where) => where.replace(a, b));
338
- const filter = curry((cond, data) => isArray(data)
375
+ const replace = curry3((a, b, where) => where.replace(a, b));
376
+ const filter = curry2((cond, data) => isArray(data)
339
377
  ? data.filter(cond)
340
378
  : compose(fromPairs, filter(([k, v]) => cond(v, k)), toPairs)(data));
341
379
  const memoize = (fn) => {
@@ -343,13 +381,13 @@ const memoize = (fn) => {
343
381
  let cached = false;
344
382
  return () => cached ? cache : (cached = true, cache = fn());
345
383
  };
346
- const mergeShallow = curry((o1, o2) => Object.assign({}, o1, o2));
347
- const mergeDeep$1 = curry((a, b) => qmergeDeep(clone(a), clone(b)));
348
- const mergeDeepX = curry((a, b) => qmergeDeepX(clone(a), clone(b)));
349
- const mergeDeepAdd = curry((a, b) => qmergeDeepAdd(clone(a), clone(b)));
350
- const overProp = curry((prop, pipe, data) => assoc(prop, pipe(data[prop]), data));
384
+ const mergeShallow = curry2((o1, o2) => Object.assign({}, o1, o2));
385
+ const mergeDeep = curry2((a, b) => qmergeDeep(clone(a), clone(b)));
386
+ const mergeDeepX = curry2((a, b) => qmergeDeepX(clone(a), clone(b)));
387
+ const mergeDeepAdd = curry2((a, b) => qmergeDeepAdd(clone(a), clone(b)));
388
+ const overProp = curry3((prop, pipe, data) => assoc(prop, pipe(data[prop]), data));
351
389
  /** mapKeys({ a: 'b' }, { a: 44 }) -> { b: 44 } */
352
- const mapKeys = curry((keyMap, o) => qmapKeys(keyMap, Object.assign({}, o)));
390
+ const mapKeys = curry2((keyMap, o) => qmapKeys(keyMap, Object.assign({}, o)));
353
391
  // ASYNCS
354
392
  /** One promise waits for another. */
355
393
  const forEachSerial = (() => {
@@ -359,12 +397,13 @@ const forEachSerial = (() => {
359
397
  await pipe(fn, items, ++i);
360
398
  }
361
399
  };
362
- return curry((fn, items) => pipe(fn, items, 0));
400
+ return curry2((fn, items) => pipe(fn, items, 0));
363
401
  })();
364
402
  /** Promise.all wrapper for functional pipelining. */
365
403
  const waitAll = (promises) => Promise.all(promises);
404
+ const waitTap = curry2(async (fn, s) => { await fn(s); return s; });
366
405
  /** Waits for all promises mapped by the fn. */
367
- const forEachAsync = curry((fn, items) => Promise.all(items.map(fn)));
406
+ const forEachAsync = curry2((fn, items) => Promise.all(items.map(fn)));
368
407
  /** The same as compose, but waits for promises in chains and returns a Promise. */
369
408
  const composeAsync = (() => {
370
409
  const pipe = async (fns, data, i) => ~i ? await pipe(fns, await fns[i](data), --i) : data;
@@ -417,12 +456,13 @@ const getTmpl = (tmpl) => {
417
456
  };
418
457
  };
419
458
 
420
-
421
-
422
459
  var pepka = /*#__PURE__*/Object.freeze({
423
460
  __proto__: null,
424
461
  __: __,
425
462
  curry: curry,
463
+ curry2: curry2,
464
+ curry3: curry3,
465
+ uncurry: uncurry,
426
466
  toLower: toLower,
427
467
  toUpper: toUpper,
428
468
  type: type,
@@ -487,6 +527,7 @@ var pepka = /*#__PURE__*/Object.freeze({
487
527
  pathEq: pathEq,
488
528
  pathsEq: pathsEq,
489
529
  clone: clone,
530
+ cloneShallow: cloneShallow,
490
531
  reduce: reduce,
491
532
  pickBy: pickBy,
492
533
  pick: pick,
@@ -503,13 +544,14 @@ var pepka = /*#__PURE__*/Object.freeze({
503
544
  filter: filter,
504
545
  memoize: memoize,
505
546
  mergeShallow: mergeShallow,
506
- mergeDeep: mergeDeep$1,
547
+ mergeDeep: mergeDeep,
507
548
  mergeDeepX: mergeDeepX,
508
549
  mergeDeepAdd: mergeDeepAdd,
509
550
  overProp: overProp,
510
551
  mapKeys: mapKeys,
511
552
  forEachSerial: forEachSerial,
512
553
  waitAll: waitAll,
554
+ waitTap: waitTap,
513
555
  forEachAsync: forEachAsync,
514
556
  composeAsync: composeAsync,
515
557
  mirror: mirror,
package/dist/bundle.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=function(){},r=r=>{let t=0;for(const s of r)s!==e&&t++;return t},t=(r,t)=>{const s=r.length,o=r.slice(),p=t.length;let n=p,c=0;for(;n&&c<s;c++)o[c]===e&&(o[c]=t[p-n],n--);for(c=s;n;c++,n--)o[c]=t[p-n];return o},s=(e,o,p)=>{const n=e.length-o.length-r(p);if(n<1)return e(...t(o,p));{const r=(...r)=>s(e,t(o,p),r);return r.$args_left=n,r}},o=e=>(...t)=>e.length>r(t)?s(e,[],t):e(...t),p=e=>typeof e,n=e=>null===e,c=e=>"number"==p(e),x=e=>Array.isArray(e),a=e=>"function"===p(e),l={u:"U",b:"B",n:"N",s:"S",f:"F"},i=e=>{const r=p(e);return"object"===r?n(e)?"Null":e.constructor.name:l[r[0]]+r.slice(1)},u=o((e,r)=>(r.push(e),r)),f=o((e,r,t)=>(t[e]=r,t)),h=o((e,r,t)=>t.reduce(e,r)),d=o((e,r,t)=>{for(let s in t)switch(i(t[s])){case"Array":if(e>1&&"Array"===i(r[s]))switch(e){case 2:const o=r[s],p=t[s];for(const r in p)o[r]?d(e,o[r],p[r]):o[r]=p[r];break;case 3:r[s].push(...t[s])}else r[s]=t[s];break;case"Object":if("Object"===i(r[s])){d(e,r[s],t[s]);break}default:r[s]=t[s]}return r}),m=d(1),g=d(2),y=d(3),b=o((e,r)=>{let t,s,o,p;for(t in e)s=e[t],[o,p]=a(s)?s(r):[s,r[t]],r[o]=p,t!==o&&delete r[t];return r}),j=o((e,r)=>{const t=x(r);for(let s in r)e(r[s],s)||(t?r.splice(s,1):delete r[s]);return r}),O=o((e,r)=>r.indexOf(e)),w=o((e,r)=>{const t=i(e);if(t===i(r)&&("Object"===t||"Array"==t)){if(n(e)||n(r))return e===r;if(e===r)return!0;for(const t of[e,r])for(const s in t)if(!(t===r&&s in e||t===e&&s in r&&w(e[s],r[s])))return!1;return!0}return e===r}),q=o((e,r,t,s)=>e(s)?r(s):t(s)),A=o((e,r,t)=>q(e,r,F,t)),v=(...r)=>(t=e)=>{for(let s=$(r)-1;s>-1;s--)t=t===e?r[s]():r[s](t);return t},E=o((e,r)=>e.bind(r)),k=o((e,r)=>r[e]),P=o((e,r)=>{if((e=>"string"===p(e))(r))return r.includes(e);for(const t of r)if(w(t,e))return!0;return!1}),S=o((e,r,t)=>t.slice(e,c(r)?r:1/0)),D=k(0),_=S(1,null),N=o((e,r)=>e+r),B=o((e,r)=>r-e),C=e=>o((r,t)=>e(t,r)),U=e=>n(e)||(e=>void 0===e)(e),$=e=>e.length,z=e=>()=>e,F=e=>e,I=e=>!e,K=e=>(...r)=>{const t=e(...r);return a(t)&&t.$args_left?K(t):I(t)},L=e=>Object.entries(e),T=o((e,r)=>e.test(r)),X=o((e,r)=>(e(r),r)),M=o((e,r)=>[...r,e]),G=o((e,r)=>r.split(e)),H=z(!0),J=z(!1),Q=o((e,r)=>V(N(e),r-e)),R=o((e,r)=>e.filter(C(P)(r))),V=o((e,r)=>[...Array(r)].map((r,t)=>e(t))),W=o((e,r)=>e>r),Y=o((e,r)=>e<r),Z=o((e,r)=>r>=e),ee=o((e,r)=>r<=e),re=o((e,r)=>r.sort(e)),te=o((e,r)=>r.find(e)),se=o((e,r)=>r.findIndex(e)),oe=o((e,r)=>se(w(e),r)),pe=o((e,r)=>{for(const[t,s]of e)if(t(r))return s(r)}),ne=o((e,r,t)=>({...t,[e]:r})),ce=o((e,r,t)=>v(s=>{return ne(s,$(e)<2?r:ce(S(1,null,e),r,(o=t[s],n(o)||"object"!==p(o)?{}:t[s])),t);var o},D)(e)),xe=o((e,r)=>r.every(e)),ae=o((e,r)=>r.some(e)),le=o((e,r)=>e.every(e=>e(r))),ie=o((e,r)=>e.some(e=>e(r))),ue=o((e,r)=>r[e]),fe=o((e,r,t)=>w(t[e],r)),he=o((e,r,t)=>w(r[e],t[e])),de=o((e,r,t)=>q($,()=>U(t)?e:v(q(U,z(e),t=>de(e,S(1,null,r),t)),C(ue)(t),D)(r),z(t),r)),me=de(void 0),ge=o((e,r,t)=>w(me(e,t),r)),ye=o((e,r,t)=>w(me(e,r),me(e,t))),be=/^(.*?)(8|16|32|64)(Clamped)?Array$/,je=e=>{const r=i(e);switch(r){case"Null":return e;case"Array":return Pe(je,e);case"Object":const t={};for(let r in e)t[r]=je(e[r]);return t;case"String":case"Number":case"Boolean":case"Symbol":return e;default:return be.test(r)?Pe(je,e):e}},Oe=o((e,r,t)=>h(e,je(r),t)),we=o((e,r)=>Ne(e,r)),qe=o((e,r)=>{const t={};for(const s of e)s in r&&(t[s]=r[s]);return t}),Ae=o((e,r)=>Ne((r,t)=>!P(t,e),r)),ve=e=>Oe((e,r)=>ne(...r,e),{},e),Ee=o((e,r)=>e.concat(r)),ke=o((e,r)=>r.join(e)),Pe=o((e,r)=>r.map(e)),Se=o((e,r)=>r.forEach(e)),De=o((e,r,t)=>r(t)&&e(t)),_e=o((e,r,t)=>t.replace(e,r)),Ne=o((e,r)=>x(r)?r.filter(e):v(ve,Ne(([r,t])=>e(t,r)),L)(r)),Be=o((e,r)=>Object.assign({},e,r)),Ce=o((e,r)=>m(je(e),je(r))),Ue=o((e,r)=>g(je(e),je(r))),$e=o((e,r)=>y(je(e),je(r))),ze=o((e,r,t)=>ne(e,r(t[e]),t)),Fe=o((e,r)=>b(e,Object.assign({},r))),Ie=(()=>{const e=async(r,t,s)=>{s<t.length&&(await r(t[s]),await e(r,t,++s))};return o((r,t)=>e(r,t,0))})(),Ke=o((e,r)=>Promise.all(r.map(e))),Le=(()=>{const e=async(r,t,s)=>~s?await e(r,await r[s](t),--s):t;return(...r)=>t=>e(r,t,r.length-1)})(),Te=F,Xe=F,Me=F;exports.F=J,exports.T=H,exports.__=e,exports.add=N,exports.all=xe,exports.allPass=le,exports.always=z,exports.any=ae,exports.anyPass=ie,exports.append=M,exports.assoc=ne,exports.assocPath=ce,exports.bind=E,exports.both=De,exports.clone=je,exports.complement=K,exports.compose=v,exports.composeAsync=Le,exports.concat=Ee,exports.cond=pe,exports.curry=o,exports.echo=Me,exports.empty=e=>{switch(i(e)){case"String":return"";case"Object":return{};case"Array":return[];default:return}},exports.equals=w,exports.explore=(e,r="log")=>X(t=>console[r](e,t)),exports.filter=Ne,exports.find=te,exports.findIndex=se,exports.flip=C,exports.forEach=Se,exports.forEachAsync=Ke,exports.forEachSerial=Ie,exports.fromPairs=ve,exports.genBy=V,exports.getTmpl=e=>{const r=[],t=[],s=e.length;let o,p,n=0,c=0,x=!1;for(n=0;n<s;n++)switch(o=e[n],o){case"{":x=!0,c=n;break;case"}":x=!1,r.push(""),t.push(e.slice(c+1,n));break;default:x||(p=r.length-1,p<0&&(r.push(""),p++),r[p]+=o)}return e=>{const s=[],o=r.length-1;for(const p in r)n=+p,s.push(r[n]),n!==o&&s.push(me(t[n].split("."),e));return s.join("")}},exports.gt=W,exports.gte=Z,exports.head=D,exports.identity=F,exports.ifElse=q,exports.includes=P,exports.indexOf=oe,exports.intersection=R,exports.isEmpty=e=>{switch(i(e)){case"String":case"Array":return 0==$(e);case"Object":for(const r in e)return!1;return!0;default:return null}},exports.isNil=U,exports.join=ke,exports.keys=e=>Object.keys(e),exports.last=e=>e[$(e)-1],exports.length=$,exports.lt=Y,exports.lte=ee,exports.map=Pe,exports.mapKeys=Fe,exports.memoize=e=>{let r,t=!1;return()=>t?r:(t=!0,r=e())},exports.mergeDeep=Ce,exports.mergeDeepAdd=$e,exports.mergeDeepX=Ue,exports.mergeShallow=Be,exports.mirror=Te,exports.not=I,exports.nth=k,exports.omit=Ae,exports.once=e=>{let r,t=!1;return(...s)=>t?r:(t=!0,r=e(...s))},exports.overProp=ze,exports.path=me,exports.pathEq=ge,exports.pathOr=de,exports.pathsEq=ye,exports.pick=qe,exports.pickBy=we,exports.prop=ue,exports.propEq=fe,exports.propsEq=he,exports.qappend=u,exports.qassoc=f,exports.qfilter=j,exports.qindexOf=O,exports.qmapKeys=b,exports.qmergeDeep=m,exports.qmergeDeepAdd=y,exports.qmergeDeepX=g,exports.qreduce=h,exports.range=Q,exports.reduce=Oe,exports.reflect=Xe,exports.replace=_e,exports.reverse=e=>v(r=>Oe((t,s,o)=>u(e[r-o],t),[],e),N(-1),$)(e),exports.sizeof=e=>{if("Object"===i(e)){let r=0;for(let t in e)r++;return r}return $(e)},exports.slice=S,exports.sort=re,exports.split=G,exports.subtract=B,exports.tail=_,exports.tap=X,exports.test=T,exports.toLower=e=>e.toLowerCase(),exports.toPairs=L,exports.toUpper=e=>e.toUpperCase(),exports.trim=e=>e.trim(),exports.type=i,exports.uniq=e=>h((e,r)=>P(r,e)?e:u(r,e),[],e),exports.values=e=>Object.values(e),exports.waitAll=e=>Promise.all(e),exports.when=A;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=function(){},r=r=>{let t=0;for(const s of r)s!==e&&t++;return t},t=(r,t)=>{const s=r.length,o=r.slice(),p=t.length;let n=p,c=0;for(;n&&c<s;c++)o[c]===e&&(o[c]=t[p-n],n--);for(c=s;n;c++,n--)o[c]=t[p-n];return o},s=(e,o,p)=>{const n=e.length-o.length-r(p);if(n<1)return e(...t(o,p));{const r=(...r)=>s(e,t(o,p),r);return r.$args_left=n,r}},o=e=>(...t)=>e.length>r(t)?s(e,[],t):e(...t),p=e=>typeof e,n=e=>null===e,c=e=>"number"==p(e),x=e=>Array.isArray(e),a=e=>"function"===p(e),l={u:"U",b:"B",n:"N",s:"S",f:"F"},i=e=>{const r=p(e);return"object"===r?n(e)?"Null":e.constructor.name:l[r[0]]+r.slice(1)},u=o(((e,r)=>(r.push(e),r))),f=o(((e,r,t)=>(t[e]=r,t))),d=o(((e,r,t)=>t.reduce(e,r))),h=o(((e,r,t)=>{for(let s in t)switch(i(t[s])){case"Array":if(e>1&&"Array"===i(r[s]))switch(e){case 2:const o=r[s],p=t[s];for(const r in p)o[r]?h(e,o[r],p[r]):o[r]=p[r];break;case 3:r[s].push(...t[s])}else r[s]=t[s];break;case"Object":if("Object"===i(r[s])){h(e,r[s],t[s]);break}default:r[s]=t[s]}return r})),m=h(1),g=h(2),y=h(3),b=o(((e,r)=>{let t,s,o,p;for(t in e)s=e[t],[o,p]=a(s)?s(r):[s,r[t]],r[o]=p,t!==o&&delete r[t];return r})),j=o(((e,r)=>{const t=x(r);for(let s in r)e(r[s],s)||(t?r.splice(s,1):delete r[s]);return r})),O=o(((e,r)=>r.indexOf(e))),w=o(((e,r)=>{const t=i(e);if(t===i(r)&&("Object"===t||"Array"==t)){if(n(e)||n(r))return e===r;if(e===r)return!0;for(const t of[e,r])for(const s in t)if(!(t===r&&s in e||t===e&&s in r&&w(e[s],r[s])))return!1;return!0}return e===r})),q=o(((e,r,t,s)=>e(s)?r(s):t(s))),A=o(((e,r,t)=>q(e,r,F,t))),E=(...r)=>(t=e)=>{for(let s=$(r)-1;s>-1;s--)t=t===e?r[s]():r[s](t);return t},k=o(((e,r)=>e.bind(r))),v=o(((e,r)=>r[e])),P=o(((e,r)=>{if((e=>"string"===p(e))(r))return r.includes(e);for(const t of r)if(w(t,e))return!0;return!1})),S=o(((e,r,t)=>t.slice(e,c(r)?r:1/0))),D=v(0),_=S(1,null),N=o(((e,r)=>e+r)),B=o(((e,r)=>r-e)),C=e=>o(((r,t)=>e(t,r))),U=e=>n(e)||(e=>void 0===e)(e),$=e=>e.length,z=e=>()=>e,F=e=>e,I=e=>!e,K=e=>(...r)=>{const t=e(...r);return a(t)&&t.$args_left?K(t):I(t)},L=e=>Object.entries(e),T=o(((e,r)=>e.test(r))),X=o(((e,r)=>(e(r),r))),M=o(((e,r)=>[...r,e])),G=o(((e,r)=>r.split(e))),H=z(!0),J=z(!1),Q=o(((e,r)=>V(N(e),r-e))),R=o(((e,r)=>e.filter(C(P)(r)))),V=o(((e,r)=>[...Array(r)].map(((r,t)=>e(t))))),W=o(((e,r)=>e>r)),Y=o(((e,r)=>e<r)),Z=o(((e,r)=>r>=e)),ee=o(((e,r)=>r<=e)),re=o(((e,r)=>r.sort(e))),te=o(((e,r)=>r.find(e))),se=o(((e,r)=>r.findIndex(e))),oe=o(((e,r)=>se(w(e),r))),pe=o(((e,r)=>{for(const[t,s]of e)if(t(r))return s(r)})),ne=o(((e,r,t)=>({...t,[e]:r}))),ce=o(((e,r,t)=>E((s=>{return ne(s,$(e)<2?r:ce(S(1,null,e),r,(o=t[s],n(o)||"object"!==p(o)?{}:t[s])),t);var o}),D)(e))),xe=o(((e,r)=>r.every(e))),ae=o(((e,r)=>r.some(e))),le=o(((e,r)=>e.every((e=>e(r))))),ie=o(((e,r)=>e.some((e=>e(r))))),ue=o(((e,r)=>r[e])),fe=o(((e,r,t)=>w(t[e],r))),de=o(((e,r,t)=>w(r[e],t[e]))),he=o(((e,r,t)=>q($,(()=>U(t)?e:E(q(U,z(e),(t=>he(e,S(1,null,r),t))),C(ue)(t),D)(r)),z(t),r))),me=he(undefined),ge=o(((e,r,t)=>w(me(e,t),r))),ye=o(((e,r,t)=>w(me(e,r),me(e,t)))),be=/^(.*?)(8|16|32|64)(Clamped)?Array$/,je=e=>{const r=i(e);switch(r){case"Null":return e;case"Array":return Pe(je,e);case"Object":const t={};for(let r in e)t[r]=je(e[r]);return t;case"String":case"Number":case"Boolean":case"Symbol":return e;default:return be.test(r)?Pe(je,e):e}},Oe=o(((e,r,t)=>d(e,je(r),t))),we=o(((e,r)=>Ne(e,r))),qe=o(((e,r)=>{const t={};for(const s of e)s in r&&(t[s]=r[s]);return t})),Ae=o(((e,r)=>Ne(((r,t)=>!P(t,e)),r))),Ee=e=>Oe(((e,r)=>ne(...r,e)),{},e),ke=o(((e,r)=>e.concat(r))),ve=o(((e,r)=>r.join(e))),Pe=o(((e,r)=>r.map(e))),Se=o(((e,r)=>r.forEach(e))),De=o(((e,r,t)=>r(t)&&e(t))),_e=o(((e,r,t)=>t.replace(e,r))),Ne=o(((e,r)=>x(r)?r.filter(e):E(Ee,Ne((([r,t])=>e(t,r))),L)(r))),Be=o(((e,r)=>Object.assign({},e,r))),Ce=o(((e,r)=>m(je(e),je(r)))),Ue=o(((e,r)=>g(je(e),je(r)))),$e=o(((e,r)=>y(je(e),je(r)))),ze=o(((e,r,t)=>ne(e,r(t[e]),t))),Fe=o(((e,r)=>b(e,Object.assign({},r)))),Ie=(()=>{const e=async(r,t,s)=>{s<t.length&&(await r(t[s]),await e(r,t,++s))};return o(((r,t)=>e(r,t,0)))})(),Ke=o(((e,r)=>Promise.all(r.map(e)))),Le=(()=>{const e=async(r,t,s)=>~s?await e(r,await r[s](t),--s):t;return(...r)=>t=>e(r,t,r.length-1)})(),Te=F,Xe=F,Me=F;exports.F=J,exports.T=H,exports.__=e,exports.add=N,exports.all=xe,exports.allPass=le,exports.always=z,exports.any=ae,exports.anyPass=ie,exports.append=M,exports.assoc=ne,exports.assocPath=ce,exports.bind=k,exports.both=De,exports.clone=je,exports.complement=K,exports.compose=E,exports.composeAsync=Le,exports.concat=ke,exports.cond=pe,exports.curry=o,exports.echo=Me,exports.empty=e=>{switch(i(e)){case"String":return"";case"Object":return{};case"Array":return[];default:return}},exports.equals=w,exports.explore=(e,r="log")=>X((t=>console[r](e,t))),exports.filter=Ne,exports.find=te,exports.findIndex=se,exports.flip=C,exports.forEach=Se,exports.forEachAsync=Ke,exports.forEachSerial=Ie,exports.fromPairs=Ee,exports.genBy=V,exports.getTmpl=e=>{const r=[],t=[],s=e.length;let o,p,n=0,c=0,x=!1;for(n=0;n<s;n++)switch(o=e[n],o){case"{":x=!0,c=n;break;case"}":x=!1,r.push(""),t.push(e.slice(c+1,n));break;default:x||(p=r.length-1,p<0&&(r.push(""),p++),r[p]+=o)}return e=>{const s=[],o=r.length-1;for(const p in r)n=+p,s.push(r[n]),n!==o&&s.push(me(t[n].split("."),e));return s.join("")}},exports.gt=W,exports.gte=Z,exports.head=D,exports.identity=F,exports.ifElse=q,exports.includes=P,exports.indexOf=oe,exports.intersection=R,exports.isEmpty=e=>{switch(i(e)){case"String":case"Array":return 0==$(e);case"Object":for(const r in e)return!1;return!0;default:return null}},exports.isNil=U,exports.join=ve,exports.keys=e=>Object.keys(e),exports.last=e=>e[$(e)-1],exports.length=$,exports.lt=Y,exports.lte=ee,exports.map=Pe,exports.mapKeys=Fe,exports.memoize=e=>{let r,t=!1;return()=>t?r:(t=!0,r=e())},exports.mergeDeep=Ce,exports.mergeDeepAdd=$e,exports.mergeDeepX=Ue,exports.mergeShallow=Be,exports.mirror=Te,exports.not=I,exports.nth=v,exports.omit=Ae,exports.once=e=>{let r,t=!1;return(...s)=>t?r:(t=!0,r=e(...s))},exports.overProp=ze,exports.path=me,exports.pathEq=ge,exports.pathOr=he,exports.pathsEq=ye,exports.pick=qe,exports.pickBy=we,exports.prop=ue,exports.propEq=fe,exports.propsEq=de,exports.qappend=u,exports.qassoc=f,exports.qfilter=j,exports.qindexOf=O,exports.qmapKeys=b,exports.qmergeDeep=m,exports.qmergeDeepAdd=y,exports.qmergeDeepX=g,exports.qreduce=d,exports.range=Q,exports.reduce=Oe,exports.reflect=Xe,exports.replace=_e,exports.reverse=e=>E((r=>Oe(((t,s,o)=>u(e[r-o],t)),[],e)),N(-1),$)(e),exports.sizeof=e=>{if("Object"===i(e)){let r=0;for(let t in e)r++;return r}return $(e)},exports.slice=S,exports.sort=re,exports.split=G,exports.subtract=B,exports.tail=_,exports.tap=X,exports.test=T,exports.toLower=e=>e.toLowerCase(),exports.toPairs=L,exports.toUpper=e=>e.toUpperCase(),exports.trim=e=>e.trim(),exports.type=i,exports.uniq=e=>d(((e,r)=>P(r,e)?e:u(r,e)),[],e),exports.values=e=>Object.values(e),exports.waitAll=e=>Promise.all(e),exports.when=A;
package/dist/es/quick.js CHANGED
@@ -78,4 +78,5 @@ export const qfilter = curry((cond, data) => {
78
78
  }
79
79
  return data;
80
80
  });
81
+ /** @deprecated */
81
82
  export const qindexOf = curry((x, xs) => xs.indexOf(x));
package/dist/es/types.js CHANGED
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -19,6 +19,7 @@
19
19
  "d.ts"
20
20
  ],
21
21
  "license": "MIT",
22
+ "type": "module",
22
23
  "main": "dist/bundle.js",
23
24
  "module": "dist/es/index.js",
24
25
  "name": "pepka",
@@ -38,15 +39,13 @@
38
39
  "prod": "npm run gentypes && npm run prod:es && npm run prod:cjs",
39
40
  "all": "npm run dev && npm run prod"
40
41
  },
41
- "version": "0.12.2",
42
+ "version": "0.13.0b1",
42
43
  "ava": {
43
44
  "files": [
44
45
  "./test/specs/*.ts"
45
46
  ],
46
- "serial": false,
47
47
  "failFast": true,
48
48
  "timeout": "2m",
49
- "compileEnhancements": false,
50
49
  "extensions": [
51
50
  "ts"
52
51
  ],
@@ -54,25 +53,24 @@
54
53
  "ts-node/register"
55
54
  ]
56
55
  },
57
- "dependencies": {},
58
56
  "devDependencies": {
59
- "@types/node": "^13.9.2",
60
- "ava": "^2.4.0",
61
- "codecov": "^3.6.5",
62
- "cross-env": "^7.0.2",
63
- "dts-bundle-generator": "^4.0.0",
64
- "nyc": "^15.0.0",
65
- "rollup": "^2.1.0",
57
+ "@types/node": "^18.11.10",
58
+ "ava": "^5.1.0",
59
+ "codecov": "^3.8.2",
60
+ "cross-env": "^7.0.3",
61
+ "dts-bundle-generator": "^7.1.0",
62
+ "nyc": "^15.1.0",
63
+ "rollup": "^3.5.1",
66
64
  "rollup-plugin-commonjs": "^10.1.0",
67
65
  "rollup-plugin-node-resolve": "^5.2.0",
68
66
  "rollup-plugin-replace": "^2.2.0",
69
67
  "rollup-plugin-resolve-aliases": "^0.3.0",
70
- "rollup-plugin-terser": "^5.3.0",
71
- "rollup-plugin-typescript2": "^0.26.0",
72
- "ts-node": "^8.7.0",
73
- "ts-toolbelt": "^6.3.6",
68
+ "rollup-plugin-terser": "^7.0.2",
69
+ "rollup-plugin-typescript2": "^0.34.1",
70
+ "ts-node": "^10.9.1",
71
+ "ts-toolbelt": "^9.6.0",
74
72
  "tslint": "^6.1.0",
75
- "typescript": "^3.8.3"
73
+ "typescript": "^4.9.3"
76
74
  },
77
75
  "types": "./dist/bundle.d.ts",
78
76
  "sideEffects": false
package/rollup.config.js CHANGED
@@ -1,34 +1,35 @@
1
- import commonjs from 'rollup-plugin-commonjs'
2
- import resolve from 'rollup-plugin-node-resolve'
3
- import typescript from 'rollup-plugin-typescript2'
4
- import { terser } from 'rollup-plugin-terser'
5
- import replace from 'rollup-plugin-replace'
6
-
7
- export default {
8
- input: process.env.NODE_ENV=='development' ? 'test/in-browser.ts' : 'src/index.ts',
9
- output: {
10
- file: process.env.BUILD == 'cjs' ? 'dist/bundle.js' : 'dist/bundle.dev.js',
11
- format: process.env.BUILD == 'cjs' ? 'cjs' : 'es',
12
- exports: 'named',
13
- name: 'pepka'
14
- },
15
- plugins: [
16
- resolve(),
17
- commonjs(),
18
- typescript({
19
- typescript: require("typescript"),
20
- tsconfig: "./tsconfig.json",
21
- tsconfigOverride: {
22
- compilerOptions: {
23
- sourceMap: false,
24
- inlineSourceMap: process.env.NODE_ENV=='development',
25
- module: 'esnext'
26
- }
27
- }
28
- }),
29
- process.env.NODE_ENV!='development' && terser(),
30
- replace({
31
- 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
32
- })
33
- ]
1
+ import commonjs from 'rollup-plugin-commonjs'
2
+ import resolve from 'rollup-plugin-node-resolve'
3
+ import typescript from 'rollup-plugin-typescript2'
4
+ import { terser } from 'rollup-plugin-terser'
5
+ import replace from 'rollup-plugin-replace'
6
+ import tsc from 'typescript'
7
+
8
+ export default {
9
+ input: process.env.NODE_ENV=='development' ? 'test/in-browser.ts' : 'src/index.ts',
10
+ output: {
11
+ file: process.env.BUILD == 'cjs' ? 'dist/bundle.js' : 'dist/bundle.dev.js',
12
+ format: process.env.BUILD == 'cjs' ? 'cjs' : 'es',
13
+ exports: 'named',
14
+ name: 'pepka'
15
+ },
16
+ plugins: [
17
+ resolve(),
18
+ commonjs(),
19
+ typescript({
20
+ typescript: tsc,
21
+ tsconfig: "./tsconfig.json",
22
+ tsconfigOverride: {
23
+ compilerOptions: {
24
+ sourceMap: false,
25
+ inlineSourceMap: process.env.NODE_ENV=='development',
26
+ module: 'esnext'
27
+ }
28
+ }
29
+ }),
30
+ process.env.NODE_ENV!='development' && terser(),
31
+ replace({
32
+ 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
33
+ })
34
+ ]
34
35
  }
package/src/common.ts CHANGED
@@ -1,15 +1,15 @@
1
- import { to, isNull } from "./utils"
2
-
3
- // It's faster that toUpperCase() !
4
- const caseMap = {
5
- u: 'U', b: 'B', n: 'N', s: 'S', f: 'F'
6
- }
7
-
8
- export const toLower = (s: string) => s.toLowerCase()
9
- export const toUpper = (s: string) => s.toUpperCase()
10
- export const type = (s: any) => {
11
- const t = to(s)
12
- return t==='object'
13
- ? isNull(s) ? 'Null' : s.constructor.name
14
- : caseMap[t[0]] + t.slice(1)
1
+ import { to, isNull } from "./utils"
2
+
3
+ // It's faster that toUpperCase() !
4
+ const caseMap = {
5
+ u: 'U', b: 'B', n: 'N', s: 'S', f: 'F'
6
+ }
7
+
8
+ export const toLower = (s: string) => s.toLowerCase()
9
+ export const toUpper = (s: string) => s.toUpperCase()
10
+ export const type = (s: any) => {
11
+ const t = to(s)
12
+ return t==='object'
13
+ ? isNull(s) ? 'Null' : s.constructor.name
14
+ : caseMap[t[0]] + t.slice(1)
15
15
  }