pepka 1.8.0 → 1.8.1
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/dist/bundle.cjs +4 -3
- package/dist/bundle.d.ts +1 -1
- package/dist/bundle.mjs +4 -3
- package/package.json +1 -1
- package/src/common.ts +6 -4
- package/src/quick.ts +1 -1
package/dist/bundle.cjs
CHANGED
|
@@ -101,11 +101,12 @@ const caseMap = { u: 'U', b: 'B', n: 'N', s: 'S', f: 'F' };
|
|
|
101
101
|
const symbol = Symbol();
|
|
102
102
|
const toLower = (s) => s.toLowerCase();
|
|
103
103
|
const toUpper = (s) => s.toUpperCase();
|
|
104
|
+
const cap_type = (t) => caseMap[t[0]] + t.slice(1);
|
|
104
105
|
const type = (s) => {
|
|
105
106
|
const t = to(s);
|
|
106
107
|
return t === 'object'
|
|
107
|
-
? isNull(s) ? 'Null' : s.constructor
|
|
108
|
-
:
|
|
108
|
+
? isNull(s) ? 'Null' : (s.constructor?.name || cap_type(t))
|
|
109
|
+
: cap_type(t);
|
|
109
110
|
};
|
|
110
111
|
const typeIs = curry2((t, s) => type(s) === t);
|
|
111
112
|
const eq = curry2((a, b) => a === b);
|
|
@@ -268,7 +269,7 @@ const qomit = curry2((props, o) => qfilter((_, k) => !includes(k, props), o));
|
|
|
268
269
|
/** @param prop string @param pipe (data[prop]): prop_value @param data any
|
|
269
270
|
* @returns data with prop over pipe. */
|
|
270
271
|
const qoverProp = curry3((prop, pipe, data) => qassoc(prop, pipe(data[prop]), data));
|
|
271
|
-
/** Slower than pick() (dictionary mode) !
|
|
272
|
+
/** Slower than pick() (dictionary mode) ! it's okay when the object is already in the dic mode !
|
|
272
273
|
* @param props (string|number)[]
|
|
273
274
|
* @param o AnyObject
|
|
274
275
|
* @returns AnyObject
|
package/dist/bundle.d.ts
CHANGED
|
@@ -219,7 +219,7 @@ export declare const qomit: {
|
|
|
219
219
|
/** @param prop string @param pipe (data[prop]): prop_value @param data any
|
|
220
220
|
* @returns data with prop over pipe. */
|
|
221
221
|
export declare const qoverProp: (...args: AnyArgs) => any;
|
|
222
|
-
/** Slower than pick() (dictionary mode) !
|
|
222
|
+
/** Slower than pick() (dictionary mode) ! it's okay when the object is already in the dic mode !
|
|
223
223
|
* @param props (string|number)[]
|
|
224
224
|
* @param o AnyObject
|
|
225
225
|
* @returns AnyObject
|
package/dist/bundle.mjs
CHANGED
|
@@ -99,11 +99,12 @@ const caseMap = { u: 'U', b: 'B', n: 'N', s: 'S', f: 'F' };
|
|
|
99
99
|
const symbol = Symbol();
|
|
100
100
|
const toLower = (s) => s.toLowerCase();
|
|
101
101
|
const toUpper = (s) => s.toUpperCase();
|
|
102
|
+
const cap_type = (t) => caseMap[t[0]] + t.slice(1);
|
|
102
103
|
const type = (s) => {
|
|
103
104
|
const t = to(s);
|
|
104
105
|
return t === 'object'
|
|
105
|
-
? isNull(s) ? 'Null' : s.constructor
|
|
106
|
-
:
|
|
106
|
+
? isNull(s) ? 'Null' : (s.constructor?.name || cap_type(t))
|
|
107
|
+
: cap_type(t);
|
|
107
108
|
};
|
|
108
109
|
const typeIs = curry2((t, s) => type(s) === t);
|
|
109
110
|
const eq = curry2((a, b) => a === b);
|
|
@@ -266,7 +267,7 @@ const qomit = curry2((props, o) => qfilter((_, k) => !includes(k, props), o));
|
|
|
266
267
|
/** @param prop string @param pipe (data[prop]): prop_value @param data any
|
|
267
268
|
* @returns data with prop over pipe. */
|
|
268
269
|
const qoverProp = curry3((prop, pipe, data) => qassoc(prop, pipe(data[prop]), data));
|
|
269
|
-
/** Slower than pick() (dictionary mode) !
|
|
270
|
+
/** Slower than pick() (dictionary mode) ! it's okay when the object is already in the dic mode !
|
|
270
271
|
* @param props (string|number)[]
|
|
271
272
|
* @param o AnyObject
|
|
272
273
|
* @returns AnyObject
|
package/package.json
CHANGED
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"prod": "npm run gentypes && npm run prod:es && npm run prod:cjs",
|
|
42
42
|
"all": "npm run dev && npm run prod"
|
|
43
43
|
},
|
|
44
|
-
"version": "1.8.
|
|
44
|
+
"version": "1.8.1",
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@rollup/plugin-commonjs": "^29.0.2",
|
|
47
47
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
package/src/common.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { curry2 } from "./curry"
|
|
2
2
|
import { is_typed_arr } from "./internal"
|
|
3
|
-
import {
|
|
3
|
+
import { isNull, isStr, to } from "./utils"
|
|
4
4
|
|
|
5
5
|
// It's faster that toUpperCase() !
|
|
6
6
|
const caseMap = { u: 'U', b: 'B', n: 'N', s: 'S', f: 'F' }
|
|
@@ -8,11 +8,12 @@ const caseMap = { u: 'U', b: 'B', n: 'N', s: 'S', f: 'F' }
|
|
|
8
8
|
export const symbol = Symbol()
|
|
9
9
|
export const toLower = (s: string) => s.toLowerCase()
|
|
10
10
|
export const toUpper = (s: string) => s.toUpperCase()
|
|
11
|
+
const cap_type = (t: string) => caseMap[t[0]] + t.slice(1)
|
|
11
12
|
export const type = (s: any): string => {
|
|
12
13
|
const t = to(s)
|
|
13
14
|
return t==='object'
|
|
14
|
-
? isNull(s) ? 'Null' : s.constructor
|
|
15
|
-
:
|
|
15
|
+
? isNull(s) ? 'Null' : (s.constructor?.name||cap_type(t))
|
|
16
|
+
: cap_type(t)
|
|
16
17
|
}
|
|
17
18
|
export const typeIs = curry2((t: string, s: any) => type(s)===t)
|
|
18
19
|
|
|
@@ -41,4 +42,5 @@ export const includes = curry2(
|
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
)
|
|
44
|
-
export {length} from './internal'
|
|
45
|
+
export { length } from './internal'
|
|
46
|
+
|
package/src/quick.ts
CHANGED
|
@@ -144,7 +144,7 @@ export const qomit = curry2(
|
|
|
144
144
|
export const qoverProp = curry3(
|
|
145
145
|
(prop: string, pipe: AnyFunc, data: any) => qassoc(prop, pipe(data[prop]), data)
|
|
146
146
|
)
|
|
147
|
-
/** Slower than pick() (dictionary mode) !
|
|
147
|
+
/** Slower than pick() (dictionary mode) ! it's okay when the object is already in the dic mode !
|
|
148
148
|
* @param props (string|number)[]
|
|
149
149
|
* @param o AnyObject
|
|
150
150
|
* @returns AnyObject
|