{"id":18776,"library":"scim2-filter","title":"scim2-filter","description":"A parser and evaluator for RFC 7643 SCIM 2.0 filter syntax. Version 0.2.0 allows parsing filter expressions into an AST and applying them as JavaScript functions to filter JSON objects. Supports operators (eq, co, sw, pr, gt, ge, lt, le, and, or, not) and complex filters with attribute paths and value filters. Lightweight, dependency-free, and ESM-only. No TypeScript types provided. Differentiates from generic query parsers by adhering strictly to SCIM 2.0 filtering grammar.","status":"active","version":"0.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/nazoking/scim2-filter","tags":["javascript","scim"],"install":[{"cmd":"npm install scim2-filter","lang":"bash","label":"npm"},{"cmd":"yarn add scim2-filter","lang":"bash","label":"yarn"},{"cmd":"pnpm add scim2-filter","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is ESM-only; CommonJS require will fail.","wrong":"const parse = require('scim2-filter')","symbol":"parse","correct":"import { parse } from 'scim2-filter'"},{"note":"Named export; must use ESM syntax.","wrong":"const filter = require('scim2-filter').filter","symbol":"filter","correct":"import { filter } from 'scim2-filter'"},{"note":"Package does not export any types; these are hypothetical. Actually, no TypeScript declarations are provided. Use with '// @ts-ignore' or create your own types.","wrong":"No wrong pattern known","symbol":"types (AST types)","correct":"import type { ScimFilter, FilterOperator } from 'scim2-filter'"}],"quickstart":{"code":"import { parse, filter } from 'scim2-filter';\n\nconst ast = parse(`userType eq \"Employee\" and emails[type eq \"work\" and value co \"@example.com\"]`);\nconsole.log(JSON.stringify(ast, null, 2));\n\nconst userFilter = filter(parse(`userName eq \"test1@example.com\"`));\nconst users = [\n  { userName: \"test1@example.com\" },\n  { userName: \"test2@example.com\" }\n];\nconst result = users.filter(userFilter);\nconsole.log(result); // [{ userName: \"test1@example.com\" }]","lang":"javascript","description":"Parses a SCIM 2.0 filter string into an AST, then uses the filter function to evaluate the expression against an array of objects."},"warnings":[{"fix":"Install @types/scim2-filter if available or add a declaration file manually. Alternatively, use JSDoc comments for type hints.","message":"Package has no TypeScript type declarations. Use with TypeScript may require 'any' casts or custom type definitions.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Ensure input data consists of plain JavaScript objects.","message":"The `filter` function returns a predicate that expects array elements to be objects. Non-object elements may cause runtime errors or unexpected behavior.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Validate filter syntax and implement additional attribute handling as needed.","message":"This package only parses and evaluates filters; it does not handle SCIM attribute validation, complex attribute names with sub-attributes, or proper escaping beyond the spec. Use with caution in production.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Check the package source for supported operators; consider contributing missing features.","message":"No deprecated features identified; however, version 0.2.0 may have limited support for all SCIM 2.0 filter operators (e.g., 'pr' for presence).","severity":"deprecated","affected_versions":"0.2.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Add \"type\": \"module\" to package.json or use .mjs extension for importing file.","cause":"Using ESM import in a CommonJS context (e.g., Node.js without 'type':'module' in package.json).","error":"SyntaxError: Cannot use import statement outside a module"},{"fix":"Use `import { parse } from 'scim2-filter'` instead of `import parse from 'scim2-filter'` or `const parse = require('scim2-filter')`.","cause":"Incorrect import: using default import instead of named import.","error":"TypeError: parse is not a function"},{"fix":"Ensure the result of `filter(parse(...))` is a function; use it as a callback to `Array.filter()`.","cause":"The filter function returns a predicate, but it's being called on non-array or used incorrectly.","error":"Uncaught TypeError: filter(...) is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}