node_modules ignore

This commit is contained in:
oier committed 2025-05-08 23:43:47 +02:00
1 parent e19d52f172
commit 4574544c9f
65041 files changed
+10593536

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
!function(r,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@ucast/core")):"function"==typeof define&&define.amd?define(["exports","@ucast/core"],n):n(((r=r||self).ucast=r.ucast||{},r.ucast.js={}),r.ucast.core)}(this,(function(r,n){"use strict";function t(r,n,t){for(var u=0,e=r.length;u<e;u++)if(0===t(r[u],n))return!0;return!1}function u(r,n){return Array.isArray(r)&&Number.isNaN(Number(n))}function e(r,n,t){if(!u(r,n))return t(r,n);for(var e=[],o=0;o<r.length;o++){var i=t(r[o],n);void 0!==i&&(e=e.concat(i))}return e}function o(r){return function(n,t,u){var e=u.get(t,n.field);return Array.isArray(e)?e.some((function(t){return r(n,t,u)})):r(n,e,u)}}function i(){return(i=Object.assign||function(r){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var u in t)Object.prototype.hasOwnProperty.call(t,u)&&(r[u]=t[u])}return r}).apply(this,arguments)}var f=function(r,n){return r[n]};function c(r,n,t){var u=n.lastIndexOf(".");return-1===u?[r,n]:[t(r,n.slice(0,u)),n.slice(u+1)]}function a(r,t,u){if(void 0===u&&(u=f),t===n.ITSELF)return r;if(!r)throw new Error('Unable to get field "'+t+'" out of '+String(r)+".");return function(r,n,t){if(-1===n.indexOf("."))return e(r,n,t);for(var u=n.split("."),o=r,i=0,f=u.length;i<f;i++)if(!(o=e(o,u[i],t))||"object"!=typeof o)return o;return o}(r,t,u)}function v(r,n){return r===n?0:r>n?1:-1}function l(r,t){return void 0===t&&(t={}),n.createInterpreter(r,i({get:a,compare:v},t))}var s=function(r,n,t){var u=t.interpret;return r.value.some((function(r){return u(r,n)}))},d=function(r,n,t){return!s(r,n,t)},y=function(r,n,t){var u=t.interpret;return r.value.every((function(r){return u(r,n)}))},p=function(r,n,t){return!(0,t.interpret)(r.value[0],n)},b=function(r,n,u){var e=u.compare,o=(0,u.get)(n,r.field);return Array.isArray(o)&&!Array.isArray(r.value)?t(o,r.value,e):0===e(o,r.value)},g=function(r,n,t){return!b(r,n,t)},m=o((function(r,n,t){var u=t.compare(n,r.value);return 0===u||-1===u})),A=o((function(r,n,t){return-1===t.compare(n,r.value)})),h=o((function(r,n,t){return 1===t.compare(n,r.value)})),j=o((function(r,n,t){var u=t.compare(n,r.value);return 0===u||1===u})),_=function(r,t,e){var o=e.get;if(r.field===n.ITSELF)return void 0!==t;var i=c(t,r.field,o),f=i[0],a=i[1],v=function(n){return null==n?Boolean(n)===r.value:n.hasOwnProperty(a)===r.value};return u(f,a)?f.some(v):v(f)},x=o((function(r,n){return"number"==typeof n&&n%r.value[0]===r.value[1]})),w=function(r,t,e){var o=e.get,i=c(t,r.field,o),f=i[0],a=i[1],v=function(n){var t=o(n,a);return Array.isArray(t)&&t.length===r.value};return r.field!==n.ITSELF&&u(f,a)?f.some(v):v(f)},O=o((function(r,n){return"string"==typeof n&&r.value.test(n)})),q=o((function(r,n,u){var e=u.compare;return t(r.value,n,e)})),M=function(r,n,t){return!q(r,n,t)},N=function(r,n,u){var e=u.compare,o=(0,u.get)(n,r.field);return Array.isArray(o)&&r.value.every((function(r){return t(o,r,e)}))},z=function(r,n,t){var u=t.interpret,e=(0,t.get)(n,r.field);return Array.isArray(e)&&e.some((function(n){return u(r.value,n)}))},B=function(r,n){return r.value.call(n)},E=i({},Object.freeze({__proto__:null,or:s,nor:d,and:y,not:p,eq:b,ne:g,lte:m,lt:A,gt:h,gte:j,exists:_,mod:x,size:w,regex:O,within:q,nin:M,all:N,elemMatch:z,where:B}),{in:q}),S=l(E);r.all=N,r.allInterpreters=E,r.and=y,r.compare=v,r.createGetter=function(r){return function(n,t){return a(n,t,r)}},r.createJsInterpreter=l,r.elemMatch=z,r.eq=b,r.exists=_,r.getObjectField=a,r.getObjectFieldCursor=c,r.gt=h,r.gte=j,r.interpret=S,r.lt=A,r.lte=m,r.mod=x,r.ne=g,r.nin=M,r.nor=d,r.not=p,r.or=s,r.regex=O,r.size=w,r.where=B,r.within=q,Object.defineProperty(r,"__esModule",{value:!0})}));
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../src/utils.ts","../../src/interpreter.ts","../../src/interpreters.ts","../../src/defaults.ts"],"sourcesContent":["import { FieldCondition } from '@ucast/core';\nimport { JsInterpretationOptions, JsInterpreter } from './types';\n\nexport type AnyObject = Record<PropertyKey, unknown>;\nexport type GetField = (object: any, field: string) => any;\n\nexport function includes<T>(\n items: T[],\n value: T,\n compare: JsInterpretationOptions['compare']\n): boolean {\n for (let i = 0, length = items.length; i < length; i++) {\n if (compare(items[i], value) === 0) {\n return true;\n }\n }\n\n return false;\n}\n\nexport function isArrayAndNotNumericField<T>(object: T | T[], field: string): object is T[] {\n return Array.isArray(object) && Number.isNaN(Number(field));\n}\n\nfunction getField<T extends AnyObject>(object: T | T[], field: string, get: GetField) {\n if (!isArrayAndNotNumericField(object, field)) {\n return get(object, field);\n }\n\n let result: unknown[] = [];\n\n for (let i = 0; i < object.length; i++) {\n const value = get(object[i], field);\n if (typeof value !== 'undefined') {\n result = result.concat(value);\n }\n }\n\n return result;\n}\n\nexport function getValueByPath(object: AnyObject, field: string, get: GetField) {\n if (field.indexOf('.') === -1) {\n return getField(object, field, get);\n }\n\n const paths = field.split('.');\n let value = object;\n\n for (let i = 0, length = paths.length; i < length; i++) {\n value = getField(value, paths[i], get);\n\n if (!value || typeof value !== 'object') {\n return value;\n }\n }\n\n return value;\n}\n\nexport function testValueOrArray<T, U = T>(test: JsInterpreter<FieldCondition<T>, U>) {\n return ((node, object, context) => {\n const value = context.get(object, node.field);\n\n if (!Array.isArray(value)) {\n return test(node, value, context);\n }\n\n return value.some(v => test(node, v, context));\n }) as JsInterpreter<FieldCondition<T>, AnyObject | U>;\n}\n","import { createInterpreter, ITSELF } from '@ucast/core';\nimport { getValueByPath, AnyObject, GetField } from './utils';\nimport { JsInterpretationOptions, JsInterpreter } from './types';\n\nconst defaultGet = (object: AnyObject, field: string) => object[field];\ntype Field = string | typeof ITSELF;\n\nexport function getObjectFieldCursor<T extends {}>(object: T, path: string, get: GetField) {\n const dotIndex = path.lastIndexOf('.');\n\n if (dotIndex === -1) {\n return [object, path] as const;\n }\n\n return [\n get(object, path.slice(0, dotIndex)) as T,\n path.slice(dotIndex + 1)\n ] as const;\n}\n\nexport function getObjectField(object: unknown, field: Field, get: GetField = defaultGet) {\n if (field === ITSELF) {\n return object;\n }\n\n if (!object) {\n throw new Error(`Unable to get field \"${field}\" out of ${String(object)}.`);\n }\n\n return getValueByPath(object as Record<string, unknown>, field, get);\n}\n\nexport function createGetter<T extends GetField>(get: T) {\n return (object: Parameters<T>[0], field: Parameters<T>[1]) => getObjectField(object, field, get);\n}\n\nexport function compare<T>(a: T, b: T): 0 | 1 | -1 {\n if (a === b) {\n return 0;\n }\n\n return a > b ? 1 : -1;\n}\n\nexport function createJsInterpreter<\n T extends JsInterpreter<any>,\n O extends Partial<JsInterpretationOptions>\n>(\n operators: Record<string, T>,\n options: O = {} as O\n) {\n return createInterpreter(operators, {\n get: getObjectField,\n compare,\n ...options,\n });\n}\n","import {\n CompoundCondition as Compound,\n FieldCondition as Field,\n DocumentCondition as Document,\n Condition,\n Comparable,\n ITSELF,\n} from '@ucast/core';\nimport { JsInterpreter as Interpret } from './types';\nimport {\n includes,\n testValueOrArray,\n isArrayAndNotNumericField,\n AnyObject,\n} from './utils';\nimport { getObjectFieldCursor } from './interpreter';\n\nexport const or: Interpret<Compound> = (node, object, { interpret }) => {\n return node.value.some(condition => interpret(condition, object));\n};\n\nexport const nor: typeof or = (node, object, context) => {\n return !or(node, object, context);\n};\n\nexport const and: Interpret<Compound> = (node, object, { interpret }) => {\n return node.value.every(condition => interpret(condition, object));\n};\n\nexport const not: Interpret<Compound> = (node, object, { interpret }) => {\n return !interpret(node.value[0], object);\n};\n\nexport const eq: Interpret<Field> = (node, object, { compare, get }) => {\n const value = get(object, node.field);\n\n if (Array.isArray(value) && !Array.isArray(node.value)) {\n return includes(value, node.value, compare);\n }\n\n return compare(value, node.value) === 0;\n};\n\nexport const ne: typeof eq = (node, object, context) => {\n return !eq(node, object, context);\n};\n\nexport const lte = testValueOrArray<Comparable>((node, value, cLine truncated