feelin 4.3.0
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.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/.rspec +2 -0
- data/CHANGELOG.md +10 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/feelin.gemspec +22 -0
- data/lib/feelin/js/node_modules/.package-lock.json +67 -0
- data/lib/feelin/js/node_modules/@lezer/common/LICENSE +21 -0
- data/lib/feelin/js/node_modules/@lezer/common/README.md +14 -0
- data/lib/feelin/js/node_modules/@lezer/common/dist/index.cjs +2181 -0
- data/lib/feelin/js/node_modules/@lezer/common/dist/index.d.cts +1137 -0
- data/lib/feelin/js/node_modules/@lezer/common/dist/index.d.ts +1137 -0
- data/lib/feelin/js/node_modules/@lezer/common/dist/index.js +2168 -0
- data/lib/feelin/js/node_modules/@lezer/common/package.json +32 -0
- data/lib/feelin/js/node_modules/@lezer/highlight/LICENSE +21 -0
- data/lib/feelin/js/node_modules/@lezer/highlight/README.md +14 -0
- data/lib/feelin/js/node_modules/@lezer/highlight/dist/index.cjs +915 -0
- data/lib/feelin/js/node_modules/@lezer/highlight/dist/index.d.cts +621 -0
- data/lib/feelin/js/node_modules/@lezer/highlight/dist/index.d.ts +623 -0
- data/lib/feelin/js/node_modules/@lezer/highlight/dist/index.js +904 -0
- data/lib/feelin/js/node_modules/@lezer/highlight/package.json +31 -0
- data/lib/feelin/js/node_modules/@lezer/lr/LICENSE +21 -0
- data/lib/feelin/js/node_modules/@lezer/lr/README.md +25 -0
- data/lib/feelin/js/node_modules/@lezer/lr/dist/constants.d.ts +45 -0
- data/lib/feelin/js/node_modules/@lezer/lr/dist/constants.js +5 -0
- data/lib/feelin/js/node_modules/@lezer/lr/dist/index.cjs +1890 -0
- data/lib/feelin/js/node_modules/@lezer/lr/dist/index.d.cts +303 -0
- data/lib/feelin/js/node_modules/@lezer/lr/dist/index.d.ts +303 -0
- data/lib/feelin/js/node_modules/@lezer/lr/dist/index.js +1883 -0
- data/lib/feelin/js/node_modules/@lezer/lr/package.json +32 -0
- data/lib/feelin/js/node_modules/feelin/LICENSE +21 -0
- data/lib/feelin/js/node_modules/feelin/README.md +65 -0
- data/lib/feelin/js/node_modules/feelin/dist/builtins.d.ts +355 -0
- data/lib/feelin/js/node_modules/feelin/dist/index.cjs +2072 -0
- data/lib/feelin/js/node_modules/feelin/dist/index.cjs.map +1 -0
- data/lib/feelin/js/node_modules/feelin/dist/index.d.ts +3 -0
- data/lib/feelin/js/node_modules/feelin/dist/index.esm.js +2063 -0
- data/lib/feelin/js/node_modules/feelin/dist/index.esm.js.map +1 -0
- data/lib/feelin/js/node_modules/feelin/dist/interpreter.d.ts +26 -0
- data/lib/feelin/js/node_modules/feelin/dist/parser.d.ts +4 -0
- data/lib/feelin/js/node_modules/feelin/dist/temporal.d.ts +6 -0
- data/lib/feelin/js/node_modules/feelin/dist/types.d.ts +35 -0
- data/lib/feelin/js/node_modules/feelin/dist/utils.d.ts +12 -0
- data/lib/feelin/js/node_modules/feelin/package.json +63 -0
- data/lib/feelin/js/node_modules/lezer-feel/LICENSE +21 -0
- data/lib/feelin/js/node_modules/lezer-feel/README.md +94 -0
- data/lib/feelin/js/node_modules/lezer-feel/dist/index.cjs +1328 -0
- data/lib/feelin/js/node_modules/lezer-feel/dist/index.cjs.map +1 -0
- data/lib/feelin/js/node_modules/lezer-feel/dist/index.d.ts +32 -0
- data/lib/feelin/js/node_modules/lezer-feel/dist/index.js +1323 -0
- data/lib/feelin/js/node_modules/lezer-feel/dist/index.js.map +1 -0
- data/lib/feelin/js/node_modules/lezer-feel/package.json +61 -0
- data/lib/feelin/js/node_modules/luxon/LICENSE.md +7 -0
- data/lib/feelin/js/node_modules/luxon/README.md +55 -0
- data/lib/feelin/js/node_modules/luxon/build/amd/luxon.js +8623 -0
- data/lib/feelin/js/node_modules/luxon/build/amd/luxon.js.map +1 -0
- data/lib/feelin/js/node_modules/luxon/build/cjs-browser/luxon.js +8621 -0
- data/lib/feelin/js/node_modules/luxon/build/cjs-browser/luxon.js.map +1 -0
- data/lib/feelin/js/node_modules/luxon/build/es6/luxon.js +8011 -0
- data/lib/feelin/js/node_modules/luxon/build/es6/luxon.js.map +1 -0
- data/lib/feelin/js/node_modules/luxon/build/global/luxon.js +8626 -0
- data/lib/feelin/js/node_modules/luxon/build/global/luxon.js.map +1 -0
- data/lib/feelin/js/node_modules/luxon/build/global/luxon.min.js +1 -0
- data/lib/feelin/js/node_modules/luxon/build/global/luxon.min.js.map +1 -0
- data/lib/feelin/js/node_modules/luxon/build/node/luxon.js +7679 -0
- data/lib/feelin/js/node_modules/luxon/build/node/luxon.js.map +1 -0
- data/lib/feelin/js/node_modules/luxon/package.json +87 -0
- data/lib/feelin/js/node_modules/luxon/src/datetime.js +2566 -0
- data/lib/feelin/js/node_modules/luxon/src/duration.js +990 -0
- data/lib/feelin/js/node_modules/luxon/src/errors.js +61 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/conversions.js +206 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/diff.js +95 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/digits.js +90 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/english.js +233 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/formats.js +176 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/formatter.js +409 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/invalid.js +14 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/locale.js +554 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/regexParser.js +335 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/tokenParser.js +505 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/util.js +316 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/zoneUtil.js +34 -0
- data/lib/feelin/js/node_modules/luxon/src/info.js +205 -0
- data/lib/feelin/js/node_modules/luxon/src/interval.js +665 -0
- data/lib/feelin/js/node_modules/luxon/src/luxon.js +26 -0
- data/lib/feelin/js/node_modules/luxon/src/package.json +4 -0
- data/lib/feelin/js/node_modules/luxon/src/settings.js +180 -0
- data/lib/feelin/js/node_modules/luxon/src/zone.js +97 -0
- data/lib/feelin/js/node_modules/luxon/src/zones/IANAZone.js +231 -0
- data/lib/feelin/js/node_modules/luxon/src/zones/fixedOffsetZone.js +150 -0
- data/lib/feelin/js/node_modules/luxon/src/zones/invalidZone.js +53 -0
- data/lib/feelin/js/node_modules/luxon/src/zones/systemZone.js +61 -0
- data/lib/feelin/js/node_modules/min-dash/LICENSE +21 -0
- data/lib/feelin/js/node_modules/min-dash/README.md +38 -0
- data/lib/feelin/js/node_modules/min-dash/dist/array.d.ts +12 -0
- data/lib/feelin/js/node_modules/min-dash/dist/collection.d.ts +174 -0
- data/lib/feelin/js/node_modules/min-dash/dist/fn.d.ts +37 -0
- data/lib/feelin/js/node_modules/min-dash/dist/index.cjs +910 -0
- data/lib/feelin/js/node_modules/min-dash/dist/index.d.ts +5 -0
- data/lib/feelin/js/node_modules/min-dash/dist/index.esm.js +872 -0
- data/lib/feelin/js/node_modules/min-dash/dist/lang.d.ts +29 -0
- data/lib/feelin/js/node_modules/min-dash/dist/min-dash.js +916 -0
- data/lib/feelin/js/node_modules/min-dash/dist/min-dash.min.js +1 -0
- data/lib/feelin/js/node_modules/min-dash/dist/object.d.ts +112 -0
- data/lib/feelin/js/node_modules/min-dash/package.json +72 -0
- data/lib/feelin/js/package-lock.json +72 -0
- data/lib/feelin/js/package.json +5 -0
- data/lib/feelin/version.rb +3 -0
- data/lib/feelin.rb +63 -0
- data/spec/feelin/feelin_spec.rb +38 -0
- data/spec/spec_helper.rb +2 -0
- metadata +198 -0
@@ -0,0 +1 @@
|
|
1
|
+
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n="undefined"!=typeof globalThis?globalThis:n||self).MinDash={})}(this,(function(n){"use strict";const t=Object.prototype.toString,e=Object.prototype.hasOwnProperty;function r(n){return void 0===n}function o(n){return void 0!==n}function u(n){return null==n}function i(n){return"[object Array]"===t.call(n)}function c(n){return"[object Object]"===t.call(n)}function f(n){const e=t.call(n);return"[object Function]"===e||"[object AsyncFunction]"===e||"[object GeneratorFunction]"===e||"[object AsyncGeneratorFunction]"===e||"[object Proxy]"===e}function l(n){if(!i(n))throw new Error("must supply array")}function s(n,t){return!u(n)&&e.call(n,t)}function a(n,t){const e=w(t);let r;return p(n,(function(n,t){if(e(n,t))return r=n,!1})),r}function p(n,t){let e,o;if(r(n))return;const u=i(n)?O:v;for(let r in n)if(s(n,r)&&(e=n[r],o=t(e,u(r)),!1===o))return e}function y(n,t,e){return p(n,(function(n,r){e=t(e,n,r)})),e}function d(n,t){return!!y(n,(function(n,e,r){return n&&t(e,r)}),!0)}function b(n,t){let e=[];return p(n,(function(n,r){e.push(t(n,r))})),e}function h(n){return n&&Object.keys(n)||[]}function g(n,t,e={}){return t=_(t),p(n,(function(n){let r=t(n)||"_",o=e[r];o||(o=e[r]=[]),o.push(n)})),e}function j(n,...t){n=_(n);let e={};return p(t,(t=>g(t,n,e))),b(e,(function(n,t){return n[0]}))}const m=j;function _(n){return f(n)?n:t=>t[n]}function w(n){return f(n)?n:t=>t===n}function v(n){return n}function O(n){return Number(n)}n.assign=function(n,...t){return Object.assign(n,...t)},n.bind=function(n,t){return n.bind(t)},n.debounce=function(n,t){let e,r,o,u;function i(e){let i=Date.now(),l=e?0:u+t-i;if(l>0)return c(l);n.apply(o,r),f()}function c(n){e=setTimeout(i,n)}function f(){e&&clearTimeout(e),e=u=r=o=void 0}function l(...n){u=Date.now(),r=n,o=this,e||c(t)}return l.flush=function(){e&&i(!0),f()},l.cancel=f,l},n.ensureArray=l,n.every=d,n.filter=function(n,t){const e=w(t);let r=[];return p(n,(function(n,t){e(n,t)&&r.push(n)})),r},n.find=a,n.findIndex=function(n,t){const e=w(t);let r=i(n)?-1:void 0;return p(n,(function(n,t){if(e(n,t))return r=t,!1})),r},n.flatten=function(n){return Array.prototype.concat.apply([],n)},n.forEach=p,n.get=function(n,t,e){let o=n;return p(t,(function(n){if(u(o))return o=void 0,!1;o=o[n]})),r(o)?e:o},n.groupBy=g,n.has=s,n.isArray=i,n.isDefined=o,n.isFunction=f,n.isNil=u,n.isNumber=function(n){return"[object Number]"===t.call(n)},n.isObject=c,n.isString=function(n){return"[object String]"===t.call(n)},n.isUndefined=r,n.keys=h,n.map=b,n.matchPattern=function(n){return function(t){return d(n,(function(n,e){return t[e]===n}))}},n.merge=function n(t,...e){return e.length?(p(e,(function(e){e&&c(e)&&p(e,(function(e,r){if("__proto__"===r)return;let o=t[r];c(e)?(c(o)||(o={}),t[r]=n(o,e)):t[r]=e}))})),t):t},n.omit=function(n,t){let e={};return p(Object(n),(function(n,r){-1===t.indexOf(r)&&(e[r]=n)})),e},n.pick=function(n,t){let e={},r=Object(n);return p(t,(function(t){t in r&&(e[t]=n[t])})),e},n.reduce=y,n.set=function(n,t,e){let i=n;return p(t,(function(n,c){if("number"!=typeof n&&"string"!=typeof n)throw new Error("illegal key type: "+typeof n+". Key should be of type number or string.");if("constructor"===n)throw new Error("illegal key: constructor");if("__proto__"===n)throw new Error("illegal key: __proto__");let f=t[c+1],l=i[n];o(f)&&u(l)&&(l=i[n]=isNaN(+f)?{}:[]),r(f)?r(e)?delete i[n]:i[n]=e:i=l})),n},n.size=function(n){return h(n).length},n.some=function(n,t){return!!a(n,t)},n.sortBy=function(n,t){t=_(t);let e=[];return p(n,(function(n,r){let o=t(n,r),u={d:o,v:n};for(var i=0;i<e.length;i++){let{d:n}=e[i];if(o<n)return void e.splice(i,0,u)}e.push(u)})),b(e,(n=>n.v))},n.throttle=function(n,t){let e=!1;return function(...r){e||(n(...r),e=!0,setTimeout((()=>{e=!1}),t))}},n.unionBy=m,n.uniqueBy=j,n.values=function(n){return b(n,(n=>n))},n.without=function(n,t){if(r(n))return[];l(n);const e=w(t);return n.filter((function(n,t){return!e(n,t)}))}}));
|
@@ -0,0 +1,112 @@
|
|
1
|
+
type PropertyName = string | number | symbol;
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Copy the values of all of the enumerable own properties from one or more source objects to a
|
5
|
+
* target object. Returns the target object.
|
6
|
+
*
|
7
|
+
* @param target The target object to copy to.
|
8
|
+
* @param source The source object from which to copy properties.
|
9
|
+
*/
|
10
|
+
export function assign<T, U>(target: T, source: U): T & U;
|
11
|
+
|
12
|
+
/**
|
13
|
+
* Copy the values of all of the enumerable own properties from one or more source objects to a
|
14
|
+
* target object. Returns the target object.
|
15
|
+
*
|
16
|
+
* @param target The target object to copy to.
|
17
|
+
* @param source1 The first source object from which to copy properties.
|
18
|
+
* @param source2 The second source object from which to copy properties.
|
19
|
+
*/
|
20
|
+
export function assign<T, U, V>(target: T, source1: U, source2: V): T & U & V;
|
21
|
+
|
22
|
+
/**
|
23
|
+
* Copy the values of all of the enumerable own properties from one or more source objects to a
|
24
|
+
* target object. Returns the target object.
|
25
|
+
*
|
26
|
+
* @param target The target object to copy to.
|
27
|
+
* @param source1 The first source object from which to copy properties.
|
28
|
+
* @param source2 The second source object from which to copy properties.
|
29
|
+
* @param source3 The third source object from which to copy properties.
|
30
|
+
*/
|
31
|
+
export function assign<T, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W;
|
32
|
+
|
33
|
+
/**
|
34
|
+
* Copy the values of all of the enumerable own properties from one or more source objects to a
|
35
|
+
* target object. Returns the target object.
|
36
|
+
*
|
37
|
+
* @param target The target object to copy to.
|
38
|
+
* @param sources One or more source objects from which to copy properties
|
39
|
+
*/
|
40
|
+
export function assign<T>(target: T, ...sources: any[]): T;
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Gets a nested property of a given object, with an optional default value.
|
44
|
+
*
|
45
|
+
* @param target The target of the get operation.
|
46
|
+
* @param path The path to the nested value.
|
47
|
+
* @param defaultValue The result to return if the property does not exist.
|
48
|
+
*
|
49
|
+
* @return any
|
50
|
+
*/
|
51
|
+
export function get(target: any, path: (string|number)[], defaultValue?: any): any;
|
52
|
+
|
53
|
+
/**
|
54
|
+
* Sets a nested property of a given object to the specified value.
|
55
|
+
*
|
56
|
+
* This mutates the object and returns it.
|
57
|
+
*
|
58
|
+
* @param target The target of the set operation.
|
59
|
+
* @param path The path to the nested value.
|
60
|
+
* @param value The value to set.
|
61
|
+
*
|
62
|
+
* @return the element
|
63
|
+
*/
|
64
|
+
export function set<T>(target: T, path: PropertyName[], value: any): T;
|
65
|
+
|
66
|
+
/**
|
67
|
+
* Pick properties from the given target.
|
68
|
+
*
|
69
|
+
* @param target
|
70
|
+
* @param properties
|
71
|
+
*
|
72
|
+
* @return
|
73
|
+
*/
|
74
|
+
export function pick<T, V extends keyof T>(target: T, properties: Array<V>): Pick<T, V>;
|
75
|
+
|
76
|
+
/**
|
77
|
+
* Pick properties from the given target.
|
78
|
+
*
|
79
|
+
* @param target
|
80
|
+
* @param properties
|
81
|
+
*
|
82
|
+
* @return
|
83
|
+
*/
|
84
|
+
export function pick<T, V extends PropertyName[]>(target: T, properties: V): Partial<T>;
|
85
|
+
|
86
|
+
/**
|
87
|
+
* Pick all target properties, excluding the given ones.
|
88
|
+
*
|
89
|
+
* @param target
|
90
|
+
* @param properties
|
91
|
+
*
|
92
|
+
* @return target
|
93
|
+
*/
|
94
|
+
export function omit<T, V extends keyof T>(target: T, properties: V): Omit<T, V>;
|
95
|
+
|
96
|
+
/**
|
97
|
+
* Pick all target properties, excluding the given ones.
|
98
|
+
*
|
99
|
+
* @param target
|
100
|
+
* @param properties
|
101
|
+
*
|
102
|
+
* @return target
|
103
|
+
*/
|
104
|
+
export function omit<T, V extends PropertyName[]>(target: T, properties: V): Pick<T, Exclude<keyof T, V[number]>>;
|
105
|
+
|
106
|
+
/**
|
107
|
+
* Copy the values of all of the enumerable own properties from one or more source objects to a
|
108
|
+
* target object. Returns the target object.
|
109
|
+
* @param target The target object to copy to.
|
110
|
+
* @param sources One or more source objects from which to copy properties
|
111
|
+
*/
|
112
|
+
export function merge(target: object, ...sources: any[]): any;
|
@@ -0,0 +1,72 @@
|
|
1
|
+
{
|
2
|
+
"name": "min-dash",
|
3
|
+
"version": "4.2.3",
|
4
|
+
"description": "Minimum utility toolbelt",
|
5
|
+
"main": "dist/index.cjs",
|
6
|
+
"module": "dist/index.esm.js",
|
7
|
+
"types": "dist/index.d.ts",
|
8
|
+
"type": "module",
|
9
|
+
"exports": {
|
10
|
+
".": {
|
11
|
+
"import": "./dist/index.esm.js",
|
12
|
+
"require": "./dist/index.cjs",
|
13
|
+
"types": "./dist/index.d.ts"
|
14
|
+
},
|
15
|
+
"./package.json": "./package.json"
|
16
|
+
},
|
17
|
+
"files": [
|
18
|
+
"dist"
|
19
|
+
],
|
20
|
+
"scripts": {
|
21
|
+
"all": "run-s lint test distro test:types",
|
22
|
+
"bundle": "rollup -c --bundleConfigAsCjs",
|
23
|
+
"copy": "cpx 'lib/*.d.ts' dist",
|
24
|
+
"distro": "run-s copy bundle test:integration test:bundle",
|
25
|
+
"dev": "npm test -- --watch",
|
26
|
+
"lint": "eslint .",
|
27
|
+
"prepublishOnly": "run-s distro",
|
28
|
+
"test": "mocha -r source-map-support/register --full-trace test/*.spec.js",
|
29
|
+
"test:bundle": "rollup -c test/bundling/rollup.config.js",
|
30
|
+
"test:integration": "mocha --full-trace test/integration/*.spec.{cjs,js}",
|
31
|
+
"test:types": "run-s test:types:*",
|
32
|
+
"test:types:cjs": "tsc --noEmit",
|
33
|
+
"test:types:esm": "tsc --noEmit --module node16"
|
34
|
+
},
|
35
|
+
"repository": {
|
36
|
+
"type": "git",
|
37
|
+
"url": "git+https://github.com/bpmn-io/min-dash.git"
|
38
|
+
},
|
39
|
+
"keywords": [
|
40
|
+
"lodash",
|
41
|
+
"utility",
|
42
|
+
"tool",
|
43
|
+
"belt"
|
44
|
+
],
|
45
|
+
"author": "bpmn.io <http://bpmn.io>",
|
46
|
+
"license": "MIT",
|
47
|
+
"bugs": {
|
48
|
+
"url": "https://github.com/bpmn-io/min-dash/issues"
|
49
|
+
},
|
50
|
+
"sideEffects": false,
|
51
|
+
"homepage": "https://github.com/bpmn-io/min-dash",
|
52
|
+
"devDependencies": {
|
53
|
+
"@rollup/plugin-node-resolve": "^15.3.1",
|
54
|
+
"@rollup/plugin-terser": "^0.4.4",
|
55
|
+
"@types/mocha": "^10.0.10",
|
56
|
+
"@types/node": "^20.11.5",
|
57
|
+
"@types/sinon": "^17.0.3",
|
58
|
+
"@types/sinon-chai": "^3.2.12",
|
59
|
+
"chai": "^4.5.0",
|
60
|
+
"cpx": "^1.5.0",
|
61
|
+
"eslint": "^8.56.0",
|
62
|
+
"eslint-plugin-bpmn-io": "^1.0.0",
|
63
|
+
"mocha": "^10.8.2",
|
64
|
+
"npm-run-all": "^4.1.1",
|
65
|
+
"rollup": "^4.34.7",
|
66
|
+
"sinon": "^17.0.1",
|
67
|
+
"sinon-chai": "^3.7.0",
|
68
|
+
"source-map-support": "^0.5.19",
|
69
|
+
"ts-expect": "^1.3.0",
|
70
|
+
"typescript": "^5.3.3"
|
71
|
+
}
|
72
|
+
}
|
@@ -0,0 +1,72 @@
|
|
1
|
+
{
|
2
|
+
"name": "js",
|
3
|
+
"lockfileVersion": 3,
|
4
|
+
"requires": true,
|
5
|
+
"packages": {
|
6
|
+
"": {
|
7
|
+
"dependencies": {
|
8
|
+
"feelin": "^4.3.0"
|
9
|
+
}
|
10
|
+
},
|
11
|
+
"node_modules/@lezer/common": {
|
12
|
+
"version": "1.2.3",
|
13
|
+
"resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.2.3.tgz",
|
14
|
+
"integrity": "sha512-w7ojc8ejBqr2REPsWxJjrMFsA/ysDCFICn8zEOR9mrqzOu2amhITYuLD8ag6XZf0CFXDrhKqw7+tW8cX66NaDA=="
|
15
|
+
},
|
16
|
+
"node_modules/@lezer/highlight": {
|
17
|
+
"version": "1.2.1",
|
18
|
+
"resolved": "https://registry.npmjs.org/@lezer/highlight/-/highlight-1.2.1.tgz",
|
19
|
+
"integrity": "sha512-Z5duk4RN/3zuVO7Jq0pGLJ3qynpxUVsh7IbUbGj88+uV2ApSAn6kWg2au3iJb+0Zi7kKtqffIESgNcRXWZWmSA==",
|
20
|
+
"dependencies": {
|
21
|
+
"@lezer/common": "^1.0.0"
|
22
|
+
}
|
23
|
+
},
|
24
|
+
"node_modules/@lezer/lr": {
|
25
|
+
"version": "1.4.2",
|
26
|
+
"resolved": "https://registry.npmjs.org/@lezer/lr/-/lr-1.4.2.tgz",
|
27
|
+
"integrity": "sha512-pu0K1jCIdnQ12aWNaAVU5bzi7Bd1w54J3ECgANPmYLtQKP0HBj2cE/5coBD66MT10xbtIuUr7tg0Shbsvk0mDA==",
|
28
|
+
"dependencies": {
|
29
|
+
"@lezer/common": "^1.0.0"
|
30
|
+
}
|
31
|
+
},
|
32
|
+
"node_modules/feelin": {
|
33
|
+
"version": "4.3.0",
|
34
|
+
"resolved": "https://registry.npmjs.org/feelin/-/feelin-4.3.0.tgz",
|
35
|
+
"integrity": "sha512-Uv3YNCrmXSXgkCJSfa2jR7SL/acjPhfEHKNsaL///fRJxD7epUvUJyF1WXbh8oh9Myv+z3WVClGb+rIuT7LDow==",
|
36
|
+
"dependencies": {
|
37
|
+
"@lezer/lr": "^1.4.2",
|
38
|
+
"lezer-feel": "^1.6.0",
|
39
|
+
"luxon": "^3.5.0"
|
40
|
+
},
|
41
|
+
"engines": {
|
42
|
+
"node": "*"
|
43
|
+
}
|
44
|
+
},
|
45
|
+
"node_modules/lezer-feel": {
|
46
|
+
"version": "1.7.0",
|
47
|
+
"resolved": "https://registry.npmjs.org/lezer-feel/-/lezer-feel-1.7.0.tgz",
|
48
|
+
"integrity": "sha512-UC8h3Nu4llRPISEUhv+Ne7bNkdxjf4+/DcU4KfO8zKxycWxev8d2BoVnGlG17zbQDtQJBD39ZQvWtjCeTFm69g==",
|
49
|
+
"dependencies": {
|
50
|
+
"@lezer/highlight": "^1.2.1",
|
51
|
+
"@lezer/lr": "^1.4.2",
|
52
|
+
"min-dash": "^4.2.1"
|
53
|
+
},
|
54
|
+
"engines": {
|
55
|
+
"node": "*"
|
56
|
+
}
|
57
|
+
},
|
58
|
+
"node_modules/luxon": {
|
59
|
+
"version": "3.6.0",
|
60
|
+
"resolved": "https://registry.npmjs.org/luxon/-/luxon-3.6.0.tgz",
|
61
|
+
"integrity": "sha512-WE7p0p7W1xji9qxkLYsvcIxZyfP48GuFrWIBQZIsbjCyf65dG1rv4n83HcOyEyhvzxJCrUoObCRNFgRNIQ5KNA==",
|
62
|
+
"engines": {
|
63
|
+
"node": ">=12"
|
64
|
+
}
|
65
|
+
},
|
66
|
+
"node_modules/min-dash": {
|
67
|
+
"version": "4.2.3",
|
68
|
+
"resolved": "https://registry.npmjs.org/min-dash/-/min-dash-4.2.3.tgz",
|
69
|
+
"integrity": "sha512-VLMYQI5+FcD9Ad24VcB08uA83B07OhueAlZ88jBK6PyupTvEJwllTMUqMy0wPGYs7pZUEtEEMWdHB63m3LtEcg=="
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|
data/lib/feelin.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
require "mini_racer"
|
2
|
+
|
3
|
+
module FEELIN
|
4
|
+
@@functions = Set.new
|
5
|
+
|
6
|
+
def self.evaluate(expression, context = nil)
|
7
|
+
context_json = serialize_context(context)
|
8
|
+
|
9
|
+
@@context.eval("feel.evaluate(#{JSON.generate(expression)}, #{context_json})")
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.unary_test(expression, value, context = {})
|
13
|
+
context_json = serialize_context({ **context, '?' => value })
|
14
|
+
|
15
|
+
@@context.eval("feel.unaryTest(#{JSON.generate(expression)}, #{context_json})")
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.add_function(name, proc)
|
19
|
+
@@functions.add(name)
|
20
|
+
@@context.attach(name, proc)
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def self.serialize_context(context)
|
26
|
+
if @@functions.any?
|
27
|
+
functions_json = @@functions.map do |name|
|
28
|
+
"#{name}(...args){return #{name}(...args)}"
|
29
|
+
end.join(',')
|
30
|
+
|
31
|
+
if context.nil?
|
32
|
+
"{#{functions_json}}"
|
33
|
+
else
|
34
|
+
"#{JSON.generate(context)[0...-1]},#{functions_json}}"
|
35
|
+
end
|
36
|
+
else
|
37
|
+
JSON.generate(context)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.process_module(source)
|
42
|
+
file_map = {
|
43
|
+
'feelin' => 'dist/index.cjs',
|
44
|
+
'luxon' => 'build/node/luxon.js',
|
45
|
+
'lezer-feel' => 'dist/index.cjs',
|
46
|
+
'@lezer/lr' => 'dist/index.cjs',
|
47
|
+
'min-dash' => 'dist/index.cjs',
|
48
|
+
'@lezer/highlight' => 'dist/index.cjs',
|
49
|
+
'@lezer/common' => 'dist/index.cjs',
|
50
|
+
}
|
51
|
+
|
52
|
+
source.gsub(/require\('(.+?)'\)/) do
|
53
|
+
name = $1
|
54
|
+
data = process_module(File.read("#{File.dirname(__FILE__)}/feelin/js/node_modules/#{name}/#{file_map[name]}"))
|
55
|
+
|
56
|
+
"(function() { const exports = {}; #{data} return exports })()"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
source = process_module("const feel = require('feelin')")
|
61
|
+
@@context = MiniRacer::Context.new
|
62
|
+
@@context.eval(source)
|
63
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
RSpec.describe FEELIN do
|
2
|
+
describe "#evaluate" do
|
3
|
+
context "without context" do
|
4
|
+
it "should not fail" do
|
5
|
+
expect(FEELIN.evaluate('for a in [1, 2, 3] return a * 2')).to eq [ 2, 4, 6 ]
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
context "with context" do
|
10
|
+
it "should not fail" do
|
11
|
+
expect(FEELIN.evaluate("Mike's daughter.name", {
|
12
|
+
'Mike\'s daughter.name' => 'Lisa'
|
13
|
+
})).to eq 'Lisa'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context "with custom functions" do
|
18
|
+
it "should not fail" do
|
19
|
+
FEELIN.add_function('rates', proc { [10, 20] })
|
20
|
+
expect(FEELIN.evaluate('every rate in rates() satisfies rate < 10')).to eq false
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "#unary_test" do
|
26
|
+
context "without context" do
|
27
|
+
it "should not fail" do
|
28
|
+
expect(FEELIN.unary_test('1', 1)).to eq true
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context "with context" do
|
33
|
+
it "should not fail" do
|
34
|
+
expect(FEELIN.unary_test('[1..end]', 1, { 'end' => 10 })).to eq true
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,198 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: feelin
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 4.3.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dmitry Arkhipov
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2025-03-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: mini_racer
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.18'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.18'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.12.0
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 3.12.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: byebug
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 11.1.3
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 11.1.3
|
55
|
+
description: This gem uses embed V8 JavaScript engine and feelin JavaScript library
|
56
|
+
to parse and evaluate DMN FEEL expressions
|
57
|
+
email:
|
58
|
+
- d.arkhipov@ekzo.dev
|
59
|
+
executables: []
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- ".rspec"
|
65
|
+
- CHANGELOG.md
|
66
|
+
- Gemfile
|
67
|
+
- LICENSE.txt
|
68
|
+
- README.md
|
69
|
+
- feelin.gemspec
|
70
|
+
- lib/feelin.rb
|
71
|
+
- lib/feelin/js/node_modules/.package-lock.json
|
72
|
+
- lib/feelin/js/node_modules/@lezer/common/LICENSE
|
73
|
+
- lib/feelin/js/node_modules/@lezer/common/README.md
|
74
|
+
- lib/feelin/js/node_modules/@lezer/common/dist/index.cjs
|
75
|
+
- lib/feelin/js/node_modules/@lezer/common/dist/index.d.cts
|
76
|
+
- lib/feelin/js/node_modules/@lezer/common/dist/index.d.ts
|
77
|
+
- lib/feelin/js/node_modules/@lezer/common/dist/index.js
|
78
|
+
- lib/feelin/js/node_modules/@lezer/common/package.json
|
79
|
+
- lib/feelin/js/node_modules/@lezer/highlight/LICENSE
|
80
|
+
- lib/feelin/js/node_modules/@lezer/highlight/README.md
|
81
|
+
- lib/feelin/js/node_modules/@lezer/highlight/dist/index.cjs
|
82
|
+
- lib/feelin/js/node_modules/@lezer/highlight/dist/index.d.cts
|
83
|
+
- lib/feelin/js/node_modules/@lezer/highlight/dist/index.d.ts
|
84
|
+
- lib/feelin/js/node_modules/@lezer/highlight/dist/index.js
|
85
|
+
- lib/feelin/js/node_modules/@lezer/highlight/package.json
|
86
|
+
- lib/feelin/js/node_modules/@lezer/lr/LICENSE
|
87
|
+
- lib/feelin/js/node_modules/@lezer/lr/README.md
|
88
|
+
- lib/feelin/js/node_modules/@lezer/lr/dist/constants.d.ts
|
89
|
+
- lib/feelin/js/node_modules/@lezer/lr/dist/constants.js
|
90
|
+
- lib/feelin/js/node_modules/@lezer/lr/dist/index.cjs
|
91
|
+
- lib/feelin/js/node_modules/@lezer/lr/dist/index.d.cts
|
92
|
+
- lib/feelin/js/node_modules/@lezer/lr/dist/index.d.ts
|
93
|
+
- lib/feelin/js/node_modules/@lezer/lr/dist/index.js
|
94
|
+
- lib/feelin/js/node_modules/@lezer/lr/package.json
|
95
|
+
- lib/feelin/js/node_modules/feelin/LICENSE
|
96
|
+
- lib/feelin/js/node_modules/feelin/README.md
|
97
|
+
- lib/feelin/js/node_modules/feelin/dist/builtins.d.ts
|
98
|
+
- lib/feelin/js/node_modules/feelin/dist/index.cjs
|
99
|
+
- lib/feelin/js/node_modules/feelin/dist/index.cjs.map
|
100
|
+
- lib/feelin/js/node_modules/feelin/dist/index.d.ts
|
101
|
+
- lib/feelin/js/node_modules/feelin/dist/index.esm.js
|
102
|
+
- lib/feelin/js/node_modules/feelin/dist/index.esm.js.map
|
103
|
+
- lib/feelin/js/node_modules/feelin/dist/interpreter.d.ts
|
104
|
+
- lib/feelin/js/node_modules/feelin/dist/parser.d.ts
|
105
|
+
- lib/feelin/js/node_modules/feelin/dist/temporal.d.ts
|
106
|
+
- lib/feelin/js/node_modules/feelin/dist/types.d.ts
|
107
|
+
- lib/feelin/js/node_modules/feelin/dist/utils.d.ts
|
108
|
+
- lib/feelin/js/node_modules/feelin/package.json
|
109
|
+
- lib/feelin/js/node_modules/lezer-feel/LICENSE
|
110
|
+
- lib/feelin/js/node_modules/lezer-feel/README.md
|
111
|
+
- lib/feelin/js/node_modules/lezer-feel/dist/index.cjs
|
112
|
+
- lib/feelin/js/node_modules/lezer-feel/dist/index.cjs.map
|
113
|
+
- lib/feelin/js/node_modules/lezer-feel/dist/index.d.ts
|
114
|
+
- lib/feelin/js/node_modules/lezer-feel/dist/index.js
|
115
|
+
- lib/feelin/js/node_modules/lezer-feel/dist/index.js.map
|
116
|
+
- lib/feelin/js/node_modules/lezer-feel/package.json
|
117
|
+
- lib/feelin/js/node_modules/luxon/LICENSE.md
|
118
|
+
- lib/feelin/js/node_modules/luxon/README.md
|
119
|
+
- lib/feelin/js/node_modules/luxon/build/amd/luxon.js
|
120
|
+
- lib/feelin/js/node_modules/luxon/build/amd/luxon.js.map
|
121
|
+
- lib/feelin/js/node_modules/luxon/build/cjs-browser/luxon.js
|
122
|
+
- lib/feelin/js/node_modules/luxon/build/cjs-browser/luxon.js.map
|
123
|
+
- lib/feelin/js/node_modules/luxon/build/es6/luxon.js
|
124
|
+
- lib/feelin/js/node_modules/luxon/build/es6/luxon.js.map
|
125
|
+
- lib/feelin/js/node_modules/luxon/build/global/luxon.js
|
126
|
+
- lib/feelin/js/node_modules/luxon/build/global/luxon.js.map
|
127
|
+
- lib/feelin/js/node_modules/luxon/build/global/luxon.min.js
|
128
|
+
- lib/feelin/js/node_modules/luxon/build/global/luxon.min.js.map
|
129
|
+
- lib/feelin/js/node_modules/luxon/build/node/luxon.js
|
130
|
+
- lib/feelin/js/node_modules/luxon/build/node/luxon.js.map
|
131
|
+
- lib/feelin/js/node_modules/luxon/package.json
|
132
|
+
- lib/feelin/js/node_modules/luxon/src/datetime.js
|
133
|
+
- lib/feelin/js/node_modules/luxon/src/duration.js
|
134
|
+
- lib/feelin/js/node_modules/luxon/src/errors.js
|
135
|
+
- lib/feelin/js/node_modules/luxon/src/impl/conversions.js
|
136
|
+
- lib/feelin/js/node_modules/luxon/src/impl/diff.js
|
137
|
+
- lib/feelin/js/node_modules/luxon/src/impl/digits.js
|
138
|
+
- lib/feelin/js/node_modules/luxon/src/impl/english.js
|
139
|
+
- lib/feelin/js/node_modules/luxon/src/impl/formats.js
|
140
|
+
- lib/feelin/js/node_modules/luxon/src/impl/formatter.js
|
141
|
+
- lib/feelin/js/node_modules/luxon/src/impl/invalid.js
|
142
|
+
- lib/feelin/js/node_modules/luxon/src/impl/locale.js
|
143
|
+
- lib/feelin/js/node_modules/luxon/src/impl/regexParser.js
|
144
|
+
- lib/feelin/js/node_modules/luxon/src/impl/tokenParser.js
|
145
|
+
- lib/feelin/js/node_modules/luxon/src/impl/util.js
|
146
|
+
- lib/feelin/js/node_modules/luxon/src/impl/zoneUtil.js
|
147
|
+
- lib/feelin/js/node_modules/luxon/src/info.js
|
148
|
+
- lib/feelin/js/node_modules/luxon/src/interval.js
|
149
|
+
- lib/feelin/js/node_modules/luxon/src/luxon.js
|
150
|
+
- lib/feelin/js/node_modules/luxon/src/package.json
|
151
|
+
- lib/feelin/js/node_modules/luxon/src/settings.js
|
152
|
+
- lib/feelin/js/node_modules/luxon/src/zone.js
|
153
|
+
- lib/feelin/js/node_modules/luxon/src/zones/IANAZone.js
|
154
|
+
- lib/feelin/js/node_modules/luxon/src/zones/fixedOffsetZone.js
|
155
|
+
- lib/feelin/js/node_modules/luxon/src/zones/invalidZone.js
|
156
|
+
- lib/feelin/js/node_modules/luxon/src/zones/systemZone.js
|
157
|
+
- lib/feelin/js/node_modules/min-dash/LICENSE
|
158
|
+
- lib/feelin/js/node_modules/min-dash/README.md
|
159
|
+
- lib/feelin/js/node_modules/min-dash/dist/array.d.ts
|
160
|
+
- lib/feelin/js/node_modules/min-dash/dist/collection.d.ts
|
161
|
+
- lib/feelin/js/node_modules/min-dash/dist/fn.d.ts
|
162
|
+
- lib/feelin/js/node_modules/min-dash/dist/index.cjs
|
163
|
+
- lib/feelin/js/node_modules/min-dash/dist/index.d.ts
|
164
|
+
- lib/feelin/js/node_modules/min-dash/dist/index.esm.js
|
165
|
+
- lib/feelin/js/node_modules/min-dash/dist/lang.d.ts
|
166
|
+
- lib/feelin/js/node_modules/min-dash/dist/min-dash.js
|
167
|
+
- lib/feelin/js/node_modules/min-dash/dist/min-dash.min.js
|
168
|
+
- lib/feelin/js/node_modules/min-dash/dist/object.d.ts
|
169
|
+
- lib/feelin/js/node_modules/min-dash/package.json
|
170
|
+
- lib/feelin/js/package-lock.json
|
171
|
+
- lib/feelin/js/package.json
|
172
|
+
- lib/feelin/version.rb
|
173
|
+
- spec/feelin/feelin_spec.rb
|
174
|
+
- spec/spec_helper.rb
|
175
|
+
homepage: https://github.com/ekzo-dev/feelin
|
176
|
+
licenses:
|
177
|
+
- MIT
|
178
|
+
metadata: {}
|
179
|
+
post_install_message:
|
180
|
+
rdoc_options: []
|
181
|
+
require_paths:
|
182
|
+
- lib
|
183
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
189
|
+
requirements:
|
190
|
+
- - ">="
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: '0'
|
193
|
+
requirements: []
|
194
|
+
rubygems_version: 3.5.16
|
195
|
+
signing_key:
|
196
|
+
specification_version: 4
|
197
|
+
summary: feelin Ruby wrapper
|
198
|
+
test_files: []
|