@emuanalytics/flow-rdf-core 0.0.15
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/README.md +64 -0
- package/dist/flow-rdf-core.css +1 -0
- package/dist/index.cjs +3102 -0
- package/dist/index.d.cts +61 -0
- package/dist/index.d.mts +61 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.mjs +3062 -0
- package/dist/lib/map/plugins/index.cjs +1652 -0
- package/dist/lib/map/plugins/index.d.cts +309 -0
- package/dist/lib/map/plugins/index.d.mts +309 -0
- package/dist/lib/map/plugins/index.d.ts +309 -0
- package/dist/lib/map/plugins/index.mjs +1614 -0
- package/dist/lib/utils/index.cjs +45 -0
- package/dist/lib/utils/index.d.cts +39 -0
- package/dist/lib/utils/index.d.mts +39 -0
- package/dist/lib/utils/index.d.ts +39 -0
- package/dist/lib/utils/index.mjs +5 -0
- package/dist/shared/flow-rdf-core.08975378.d.cts +68 -0
- package/dist/shared/flow-rdf-core.08975378.d.mts +68 -0
- package/dist/shared/flow-rdf-core.08975378.d.ts +68 -0
- package/dist/shared/flow-rdf-core.278a260a.cjs +1364 -0
- package/dist/shared/flow-rdf-core.2e456f93.mjs +83 -0
- package/dist/shared/flow-rdf-core.3042be4a.cjs +93 -0
- package/dist/shared/flow-rdf-core.84eded74.cjs +34 -0
- package/dist/shared/flow-rdf-core.b4b16e78.mjs +1329 -0
- package/dist/shared/flow-rdf-core.b80085b4.mjs +66 -0
- package/dist/shared/flow-rdf-core.bd95d618.mjs +29 -0
- package/dist/shared/flow-rdf-core.c44cf082.cjs +88 -0
- package/dist/shared/flow-rdf-core.c9d2f730.d.cts +1815 -0
- package/dist/shared/flow-rdf-core.c9d2f730.d.mts +1815 -0
- package/dist/shared/flow-rdf-core.c9d2f730.d.ts +1815 -0
- package/package.json +106 -0
- package/plugins/package.json +7 -0
- package/utils/package.json +7 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
const doNotMemoize = Symbol("Do not memoize");
|
|
2
|
+
function memoize(originalFunction, options) {
|
|
3
|
+
const cache = /* @__PURE__ */ new Map();
|
|
4
|
+
const hash = options.hash ? options.hash : (...args) => args[0];
|
|
5
|
+
const context = options.context;
|
|
6
|
+
return function memoizedFunction(...args) {
|
|
7
|
+
const key = hash.apply(context, args);
|
|
8
|
+
if (key === doNotMemoize) {
|
|
9
|
+
return originalFunction.apply(context, args);
|
|
10
|
+
}
|
|
11
|
+
let value;
|
|
12
|
+
if (!cache.has(key)) {
|
|
13
|
+
value = originalFunction.apply(context, args);
|
|
14
|
+
cache.set(key, value);
|
|
15
|
+
} else {
|
|
16
|
+
value = cache.get(key);
|
|
17
|
+
}
|
|
18
|
+
return value;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function throttle(callback, options) {
|
|
22
|
+
const { delay, noTrailing = false, noLeading = false, debounceMode = void 0 } = options;
|
|
23
|
+
let timeoutID;
|
|
24
|
+
let cancelled = false;
|
|
25
|
+
let lastExec = 0;
|
|
26
|
+
function clearExistingTimeout() {
|
|
27
|
+
if (timeoutID) {
|
|
28
|
+
clearTimeout(timeoutID);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function cancel(options2) {
|
|
32
|
+
const { upcomingOnly = false } = options2 || {};
|
|
33
|
+
clearExistingTimeout();
|
|
34
|
+
cancelled = !upcomingOnly;
|
|
35
|
+
}
|
|
36
|
+
function wrapper(...arguments_) {
|
|
37
|
+
const context = options.context;
|
|
38
|
+
const elapsed = Date.now() - lastExec;
|
|
39
|
+
if (cancelled) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
function exec() {
|
|
43
|
+
lastExec = Date.now();
|
|
44
|
+
callback.apply(context, arguments_);
|
|
45
|
+
}
|
|
46
|
+
function clear() {
|
|
47
|
+
timeoutID = void 0;
|
|
48
|
+
}
|
|
49
|
+
if (!noLeading && debounceMode && !timeoutID) {
|
|
50
|
+
exec();
|
|
51
|
+
}
|
|
52
|
+
clearExistingTimeout();
|
|
53
|
+
if (debounceMode === void 0 && elapsed > delay) {
|
|
54
|
+
if (noLeading) {
|
|
55
|
+
lastExec = Date.now();
|
|
56
|
+
if (!noTrailing) {
|
|
57
|
+
timeoutID = setTimeout(debounceMode ? clear : exec, delay);
|
|
58
|
+
}
|
|
59
|
+
} else {
|
|
60
|
+
exec();
|
|
61
|
+
}
|
|
62
|
+
} else if (noTrailing !== true) {
|
|
63
|
+
timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === void 0 ? delay - elapsed : delay);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
wrapper.cancel = cancel;
|
|
67
|
+
return wrapper;
|
|
68
|
+
}
|
|
69
|
+
function debounce(callback, options) {
|
|
70
|
+
const { delay, context, atBegin = false } = options;
|
|
71
|
+
return throttle(callback, { delay, debounceMode: atBegin !== false, context });
|
|
72
|
+
}
|
|
73
|
+
function debounceWithArgs(fn, options) {
|
|
74
|
+
const memoizedDebouncedFn = memoize(
|
|
75
|
+
() => debounce(fn, options),
|
|
76
|
+
options
|
|
77
|
+
);
|
|
78
|
+
return (...args) => {
|
|
79
|
+
memoizedDebouncedFn(...args)(...args);
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export { debounceWithArgs as a, debounce as d, memoize as m, throttle as t };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const isUndefined = (val) => typeof val === "undefined";
|
|
4
|
+
const isNull = (val) => val === null;
|
|
5
|
+
const isNil = (val) => isUndefined(val) || isNull(val);
|
|
6
|
+
const isDefined = (val) => !isNil(val);
|
|
7
|
+
const isString = (val) => typeof val === "string";
|
|
8
|
+
const hasLength = (val) => isDefined(val) && val.length > 0;
|
|
9
|
+
const isStringFull = (val) => isString(val) && hasLength(val);
|
|
10
|
+
const isArray = (val) => Array.isArray(val);
|
|
11
|
+
const isArrayFull = (val) => Array.isArray(val) && hasLength(val);
|
|
12
|
+
const isArrayStrings = (val) => isArrayFull(val) && val.every((v) => isStringFull(v));
|
|
13
|
+
const isObject = (val) => typeof val === "object" && !isNull(val);
|
|
14
|
+
const isObjectFull = (val) => isObject(val) && hasLength(Object.keys(val));
|
|
15
|
+
const isNumber = (val) => typeof val === "number" && !Number.isNaN(val) && Number.isFinite(val);
|
|
16
|
+
const isFalse = (val) => val === false;
|
|
17
|
+
const isTrue = (val) => val === true;
|
|
18
|
+
const isIn = (val, arr) => isArrayFull(arr) && arr.some((o) => val === o);
|
|
19
|
+
const isBoolean = (val) => typeof val === "boolean";
|
|
20
|
+
const isNumeric = (val) => isString(val) && /^[+-]?([0-9]*[.])?[0-9]+$/.test(val);
|
|
21
|
+
const isDate = (val) => val instanceof Date;
|
|
22
|
+
const isValue = (val) => isStringFull(val) || isNumber(val) || isBoolean(val) || isDate(val);
|
|
23
|
+
const hasValue = (val) => isArrayFull(val) ? val.every((o) => isValue(o)) : isValue(val);
|
|
24
|
+
const isFunction = (val) => typeof val === "function";
|
|
25
|
+
function isPlainObject(o) {
|
|
26
|
+
if (!isObject(o)) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
const ctor = o.constructor;
|
|
30
|
+
if (ctor === void 0) {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
const prot = ctor.prototype;
|
|
34
|
+
if (isObject(prot) === false) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
if (prot.hasOwnProperty("isPrototypeOf") === false) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
const urlRegex = new RegExp(
|
|
43
|
+
"^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$",
|
|
44
|
+
// fragment locator
|
|
45
|
+
"i"
|
|
46
|
+
);
|
|
47
|
+
function isURL(val) {
|
|
48
|
+
return isString(val) && !!urlRegex.test(val);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function ensureArray(a, ...rest) {
|
|
52
|
+
if (arguments.length === 0) {
|
|
53
|
+
return [];
|
|
54
|
+
}
|
|
55
|
+
if (arguments.length === 1) {
|
|
56
|
+
if (a === void 0 || a === null) {
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
if (Array.isArray(a)) {
|
|
60
|
+
return a;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return Array.prototype.slice.call(arguments);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const capitalize = (str, lowerRest = false) => str.slice(0, 1).toUpperCase() + (lowerRest ? str.slice(1).toLowerCase() : str.slice(1));
|
|
67
|
+
|
|
68
|
+
exports.capitalize = capitalize;
|
|
69
|
+
exports.ensureArray = ensureArray;
|
|
70
|
+
exports.hasLength = hasLength;
|
|
71
|
+
exports.hasValue = hasValue;
|
|
72
|
+
exports.isArray = isArray;
|
|
73
|
+
exports.isArrayFull = isArrayFull;
|
|
74
|
+
exports.isArrayStrings = isArrayStrings;
|
|
75
|
+
exports.isBoolean = isBoolean;
|
|
76
|
+
exports.isDate = isDate;
|
|
77
|
+
exports.isDefined = isDefined;
|
|
78
|
+
exports.isFalse = isFalse;
|
|
79
|
+
exports.isFunction = isFunction;
|
|
80
|
+
exports.isIn = isIn;
|
|
81
|
+
exports.isNil = isNil;
|
|
82
|
+
exports.isNull = isNull;
|
|
83
|
+
exports.isNumber = isNumber;
|
|
84
|
+
exports.isNumeric = isNumeric;
|
|
85
|
+
exports.isObject = isObject;
|
|
86
|
+
exports.isObjectFull = isObjectFull;
|
|
87
|
+
exports.isPlainObject = isPlainObject;
|
|
88
|
+
exports.isString = isString;
|
|
89
|
+
exports.isStringFull = isStringFull;
|
|
90
|
+
exports.isTrue = isTrue;
|
|
91
|
+
exports.isURL = isURL;
|
|
92
|
+
exports.isUndefined = isUndefined;
|
|
93
|
+
exports.isValue = isValue;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const invariant = require('@turf/invariant');
|
|
4
|
+
const stringUtils = require('./flow-rdf-core.3042be4a.cjs');
|
|
5
|
+
|
|
6
|
+
const isPoint = (val) => {
|
|
7
|
+
if (!stringUtils.isPlainObject(val)) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
return invariant.getType(val) === "Point";
|
|
11
|
+
};
|
|
12
|
+
const isLineString = (val) => {
|
|
13
|
+
if (!stringUtils.isPlainObject(val)) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
return invariant.getType(val) === "LineString";
|
|
17
|
+
};
|
|
18
|
+
const isPolygon = (val) => {
|
|
19
|
+
if (!stringUtils.isPlainObject(val)) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
return invariant.getType(val) === "Polygon";
|
|
23
|
+
};
|
|
24
|
+
const isMultiPolygon = (val) => {
|
|
25
|
+
if (!val) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
return invariant.getType(val) === "MultiPolygon";
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
exports.isLineString = isLineString;
|
|
32
|
+
exports.isMultiPolygon = isMultiPolygon;
|
|
33
|
+
exports.isPoint = isPoint;
|
|
34
|
+
exports.isPolygon = isPolygon;
|