@rokkit/core 1.0.0-next.106 → 1.0.0-next.107
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/index.d.ts +1 -0
- package/dist/utils.d.ts +7 -0
- package/package.json +1 -1
- package/src/field-mapper.js +1 -0
- package/src/index.js +1 -0
- package/src/utils.js +15 -0
package/dist/index.d.ts
CHANGED
|
@@ -8,5 +8,6 @@ export { FieldMapper } from "./field-mapper.js";
|
|
|
8
8
|
export { createEmitter } from "./events.js";
|
|
9
9
|
export { getLineTypes } from "./connector.js";
|
|
10
10
|
export { generateTicks } from "./ticks.js";
|
|
11
|
+
export { getValue } from "./mapping.js";
|
|
11
12
|
export { getItemAtIndex, getIndexForItem } from "./mapped-items.js";
|
|
12
13
|
export { weekdays, getCalendarDays } from "./calendar.js";
|
package/dist/utils.d.ts
CHANGED
|
@@ -59,3 +59,10 @@ export function getKeyFromPath(path: string[]): string;
|
|
|
59
59
|
* @returns {string[]}
|
|
60
60
|
*/
|
|
61
61
|
export function getPathFromKey(key: string): string[];
|
|
62
|
+
/**
|
|
63
|
+
* Get snippet function from an object
|
|
64
|
+
* @param {Object} obj
|
|
65
|
+
* @param {string} key
|
|
66
|
+
* @returns {Function|undefined}
|
|
67
|
+
*/
|
|
68
|
+
export function getSnippet(obj: Object, key: string): Function | undefined;
|
package/package.json
CHANGED
package/src/field-mapper.js
CHANGED
package/src/index.js
CHANGED
package/src/utils.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { has } from 'ramda'
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Finds the closest ancestor of the given element that has the given attribute.
|
|
3
5
|
*
|
|
@@ -101,3 +103,16 @@ export function getKeyFromPath(path) {
|
|
|
101
103
|
export function getPathFromKey(key) {
|
|
102
104
|
return key.split('-').map(Number)
|
|
103
105
|
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Get snippet function from an object
|
|
109
|
+
* @param {Object} obj
|
|
110
|
+
* @param {string} key
|
|
111
|
+
* @returns {Function|undefined}
|
|
112
|
+
*/
|
|
113
|
+
export function getSnippet(obj, key) {
|
|
114
|
+
if (has(key, obj) && typeof obj[key] === 'function') {
|
|
115
|
+
return obj[key]
|
|
116
|
+
}
|
|
117
|
+
return undefined
|
|
118
|
+
}
|