{"id":16208477,"url":"https://github.com/ehmicky/wild-wild-parser","last_synced_at":"2025-08-02T22:17:10.452Z","repository":{"id":40602308,"uuid":"473357135","full_name":"ehmicky/wild-wild-parser","owner":"ehmicky","description":"🤠 Parser for object property paths with wildcards and regexps 🌵","archived":false,"fork":false,"pushed_at":"2025-05-25T23:03:22.000Z","size":11549,"stargazers_count":13,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-25T23:48:42.788Z","etag":null,"topics":["algorithm","data-structures","filter","functional-programming","glob","globbing","globstar","javascript","json","library","map","nodejs","parsing","path","recursion","regex","regexp","regular-expression","typescript","wildcard"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ehmicky.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-03-23T21:01:03.000Z","updated_at":"2025-05-25T23:03:26.000Z","dependencies_parsed_at":"2024-04-22T20:27:41.431Z","dependency_job_id":"51ee50c6-bc7c-4bd4-bfe6-6f0bde967c53","html_url":"https://github.com/ehmicky/wild-wild-parser","commit_stats":{"total_commits":286,"total_committers":2,"mean_commits":143.0,"dds":"0.013986013986013957","last_synced_commit":"fcd1cfce3a7bfc00a1507117561ff3f4240ac143"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/ehmicky/wild-wild-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehmicky%2Fwild-wild-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehmicky%2Fwild-wild-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehmicky%2Fwild-wild-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehmicky%2Fwild-wild-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ehmicky","download_url":"https://codeload.github.com/ehmicky/wild-wild-parser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehmicky%2Fwild-wild-parser/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267172340,"owners_count":24047173,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm","data-structures","filter","functional-programming","glob","globbing","globstar","javascript","json","library","map","nodejs","parsing","path","recursion","regex","regexp","regular-expression","typescript","wildcard"],"created_at":"2024-10-10T10:17:11.493Z","updated_at":"2025-08-02T22:17:10.441Z","avatar_url":"https://github.com/ehmicky.png","language":"JavaScript","readme":"\u003cimg alt=\"wild-wild-parser logo\" src=\"https://raw.githubusercontent.com/ehmicky/design/main/wild-wild-parser/wild-wild-parser.svg?sanitize=true\" width=\"700\"/\u003e\n\n[![Node](https://img.shields.io/badge/-Node.js-808080?logo=node.js\u0026colorA=404040\u0026logoColor=66cc33)](https://www.npmjs.com/package/wild-wild-parser)\n[![Browsers](https://img.shields.io/badge/-Browsers-808080?logo=firefox\u0026colorA=404040)](https://unpkg.com/wild-wild-parser?module)\n[![TypeScript](https://img.shields.io/badge/-Typed-808080?logo=typescript\u0026colorA=404040\u0026logoColor=0096ff)](/src/main.d.ts)\n[![Codecov](https://img.shields.io/badge/-Tested%20100%25-808080?logo=codecov\u0026colorA=404040)](https://codecov.io/gh/ehmicky/wild-wild-parser)\n[![Minified size](https://img.shields.io/bundlephobia/minzip/wild-wild-parser?label\u0026colorA=404040\u0026colorB=808080\u0026logo=webpack)](https://bundlephobia.com/package/wild-wild-parser)\n[![Mastodon](https://img.shields.io/badge/-Mastodon-808080.svg?logo=mastodon\u0026colorA=404040\u0026logoColor=9590F9)](https://fosstodon.org/@ehmicky)\n[![Medium](https://img.shields.io/badge/-Medium-808080.svg?logo=medium\u0026colorA=404040)](https://medium.com/@ehmicky)\n\n🤠 Parser for object property paths with wildcards and regexps. 🌵\n\n[`wild-wild-path`](https://github.com/ehmicky/wild-wild-path) is a library which\ngets/sets object properties using\n[dot-delimited paths](https://github.com/ehmicky/wild-wild-path#%EF%B8%8F-deep-properties),\n[wildcards](https://github.com/ehmicky/wild-wild-path#-wildcards),\n[regexps](https://github.com/ehmicky/wild-wild-path#%EF%B8%8F-regexps),\n[slices](https://github.com/ehmicky/wild-wild-path#%EF%B8%8F-array-slices) and\n[unions](https://github.com/ehmicky/wild-wild-path#-unions). `wild-wild-parser`\nallows manipulating\n[its query format](https://github.com/ehmicky/wild-wild-path#queries):\n\n- 🚂 [Parse](#parsequeryquerystring)/[serialize](#serializequeryqueryarray),\n  i.e. convert between\n  [query strings](https://github.com/ehmicky/wild-wild-path#query-strings) and\n  [query arrays](https://github.com/ehmicky/wild-wild-path#query-arrays)\n- ⭐ [Normalize](#normalizequeryquery) queries\n- 🗺️ [Compare](#issamequeryfirstquery-secondquery) queries\n\n# Install\n\n```bash\nnpm install wild-wild-parser\n```\n\nThis package works in both Node.js \u003e=18.18.0 and\n[browsers](https://raw.githubusercontent.com/ehmicky/dev-tasks/main/src/browserslist).\n\nThis is an ES module. It must be loaded using\n[an `import` or `import()` statement](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c),\nnot `require()`. If TypeScript is used, it must be configured to\n[output ES modules](https://www.typescriptlang.org/docs/handbook/esm-node.html),\nnot CommonJS.\n\n# API\n\n## parseQuery(queryString)\n\n`queryString`\n[`QueryString`](https://github.com/ehmicky/wild-wild-path#query-strings)\\\n_Return value_:\n[`QueryArray`](https://github.com/ehmicky/wild-wild-path#query-arrays)\n\nConvert a\n[query string](https://github.com/ehmicky/wild-wild-path#query-strings) into a\n[query array](https://github.com/ehmicky/wild-wild-path#query-arrays).\n\n```js\nparseQuery('users.0.*') // [['users', 0, { type: 'any' }]]\nparseQuery('users admins') // [['users'], ['admins']]\nparseQuery('users./[/') // Throws: invalid RegExp\n```\n\n## serializeQuery(queryArray)\n\n`queryArray`\n[`QueryArray`](https://github.com/ehmicky/wild-wild-path#query-arrays)\\\n_Return value_:\n[`QueryString`](https://github.com/ehmicky/wild-wild-path#query-strings)\n\nConvert a [query array](https://github.com/ehmicky/wild-wild-path#query-arrays)\ninto a [query string](https://github.com/ehmicky/wild-wild-path#query-strings).\n\n```js\nserializeQuery(['users', 0, { type: 'any' }]) // 'users.0.*'\nserializeQuery([['users'], ['admins']]) // 'users admins'\nserializeQuery([true]) // Throws: `true` is not a valid query\n```\n\n## normalizeQuery(query)\n\n`query` [`Query`](https://github.com/ehmicky/wild-wild-path#queries)\\\n_Return value_:\n[`QueryArray`](https://github.com/ehmicky/wild-wild-path#query-arrays)\n\nIf the query is a\n[query string](https://github.com/ehmicky/wild-wild-path#query-strings), convert\nit into a [query array](https://github.com/ehmicky/wild-wild-path#query-arrays).\nIf it is already a query array, normalize it to a canonical form.\n\n```js\nnormalizeQuery('users.0.*') // [['users', 0, { type: 'any' }]]\nnormalizeQuery(['users']) // [['users']]\nnormalizeQuery([['users'], ['admins']]) // [['users'], ['admins']]\nnormalizeQuery([{ type: 'slice' }]) // [[{ type: 'slice', from: 0 }]]\nnormalizeQuery('users./[/') // Throws: invalid RegExp\nnormalizeQuery([true]) // Throws: `true` is not a valid query\n```\n\n## parsePath(pathString)\n\n`pathString` [`PathString`](https://github.com/ehmicky/wild-wild-path#paths)\\\n_Return value_: [`PathArray`](https://github.com/ehmicky/wild-wild-path#paths)\n\nSame as [`parseQuery()`](#parsequeryquerystring) but only for a\n[path query](https://github.com/ehmicky/wild-wild-path#paths).\n\n```js\nparsePath('users.0') // ['users', 0]\nparsePath('*') // Throws: this is a valid query but not a path\nparsePath('users./[/') // Throws: invalid RegExp\n```\n\n## serializePath(pathArray)\n\n`pathArray` [`PathArray`](https://github.com/ehmicky/wild-wild-path#paths)\\\n_Return value_: [`PathString`](https://github.com/ehmicky/wild-wild-path#paths)\n\nSame as [`serializeQuery()`](#serializequeryqueryarray) but only for a\n[path query](https://github.com/ehmicky/wild-wild-path#paths).\n\n```js\nserializePath(['users', 0]) // 'users.0'\nserializePath([{ type: 'any' }]) // Throws: this is a valid query but not a path\nserializePath([true]) // Throws: `true` is not a valid query\n```\n\n## normalizePath(path)\n\n`path` [`Path`](https://github.com/ehmicky/wild-wild-path#paths)\\\n_Return value_: [`PathArray`](https://github.com/ehmicky/wild-wild-path#paths)\n\nSame as [`normalizeQuery()`](#normalizequeryquery) but only for a\n[path query](https://github.com/ehmicky/wild-wild-path#paths).\n\n```js\nnormalizePath('users.0') // ['users', 0]\nnormalizePath(['users', 0]) // ['users', 0]\nnormalizePath('*') // Throws: `*` is a valid query but not a path\nnormalizePath([true]) // Throws: `true` is not a valid query\n```\n\n## isSameQuery(firstQuery, secondQuery)\n\n`firstQuery` [`Query`](https://github.com/ehmicky/wild-wild-path#queries)\\\n`secondQuery` [`Query`](https://github.com/ehmicky/wild-wild-path#queries)\\\n_Return value_: `boolean`\n\nReturn `true` if both queries are the same, even if they use different formats\n([string](https://github.com/ehmicky/wild-wild-path#query-strings) or\n[array](https://github.com/ehmicky/wild-wild-path#query-arrays)) or if they are\nsyntactically different but semantically identical.\n\n```js\nisSameQuery('users.0.*', 'users.0.*') // true\nisSameQuery('users.0.*', ['users', 0, { type: 'any' }]) // true\nisSameQuery(['users', 0, { type: 'any' }], ['users', 0, { type: 'any' }]) // true\nisSameQuery('users.0.*', 'users.1.*') // false\nisSameQuery('0:2', ':2') // true\nisSameQuery([['user']], ['user']) // true\nisSameQuery([true], 'user') // Throws: `true` is not a valid query\n```\n\n## isSamePath(firstPath, secondPath)\n\n`firstPath` [`Path`](https://github.com/ehmicky/wild-wild-path#paths)\\\n`secondPath` [`Path`](https://github.com/ehmicky/wild-wild-path#paths)\\\n_Return value_: `boolean`\n\nSame as [`isSameQuery()`](#issamepathfirstpath-secondpath) but only for a\n[path query](https://github.com/ehmicky/wild-wild-path#paths).\n\n```js\nisSamePath('user.name', 'user.name') // true\nisSamePath('user.name', ['user', 'name']) // true\nisSamePath(['user', 'name'], ['user', 'name']) // true\nisSamePath('user.name', 'user.lastName') // false\nisSamePath('*', 'user.name') // Throws: `*` is a valid query but not a path\nisSamePath([true], 'user.name') // Throws: `true` is not a valid query\n```\n\n## isParentPath(parentPath, childPath)\n\n`parentPath` [`Path`](https://github.com/ehmicky/wild-wild-path#paths)\\\n`childPath` [`Path`](https://github.com/ehmicky/wild-wild-path#paths)\\\n_Return value_: `boolean`\n\nReturn `true` if the first argument is a parent path to the second. Queries that\nare not [paths](https://github.com/ehmicky/wild-wild-path#paths) cannot be used.\n\n```js\nisParentPath('user', 'user.name') // true\nisParentPath('user', 'user.settings.name') // true\nisParentPath('user', ['user', 'settings', 'name']) // true\nisParentPath(['user'], ['user', 'settings', 'name']) // true\nisParentPath('user', 'user') // false\nisParentPath('user.name', 'user') // false\nisParentPath('user.name', 'user.settings') // false\nisParentPath('*', 'user.name') // Throws: `*` is valid query but not a path\nisParentPath([true], 'user.name') // Throws: `true` is not a valid query\n```\n\n## isSameToken(firstToken, secondToken)\n\n`firstToken` [`Token`](https://github.com/ehmicky/wild-wild-path#query-arrays)\\\n`secondToken` [`Token`](https://github.com/ehmicky/wild-wild-path#query-arrays)\\\n_Return value_: `boolean`\n\nSame as [`isSameQuery()`](#issamepathfirstpath-secondpath) but only for\n[query array](https://github.com/ehmicky/wild-wild-path#query-arrays) individual\ntokens.\n\n\u003c!-- eslint-disable require-unicode-regexp --\u003e\n\n```js\nisSameToken('user', 'user') // true\nisSameToken('user', 'users') // false\nisSameToken(2, 2) // true\nisSameToken(0, -0) // false\nisSameToken(/Name/, /Name/) // true\nisSameToken(/Name/, /name/i) // false\nisSameToken({ type: 'slice' }, { type: 'slice', from: 0 }) // true\nisSameToken('user', true) // Throws: invalid token `true`\n```\n\n## getTokenType(token)\n\n`token` [`Token`](https://github.com/ehmicky/wild-wild-path#query-arrays)\\\n_Return value_: `string`\n\nRetrieve the type of a\n[query array](https://github.com/ehmicky/wild-wild-path#query-arrays) individual\ntoken among: `\"prop\"`, `\"index\"`, `\"slice\"`, `\"regExp\"`, `\"any\"` or `\"anyDeep\"`.\n`\"unknown\"` is returned if the token is invalid.\n\n\u003c!-- eslint-disable require-unicode-regexp --\u003e\n\n```js\ngetTokenType('user') // \"prop\"\ngetTokenType(0) // \"index\"\ngetTokenType(/Name/) // \"regExp\"\ngetTokenType({ type: 'slice', from: 0, to: 2 }) // \"slice\"\ngetTokenType({ type: 'any' }) // \"any\"\ngetTokenType({ type: 'anyDeep' }) // \"anyDeep\"\ngetTokenType(true) // \"unknown\"\n```\n\n# Related projects\n\n- [`wild-wild-path`](https://github.com/ehmicky/wild-wild-path): get/set object\n  properties using `wild-wild-parser`'s paths\n- [`wild-wild-utils`](https://github.com/ehmicky/wild-wild-utils): functional\n  utilities using `wild-wild-parser`'s paths\n\n# Support\n\nFor any question, _don't hesitate_ to [submit an issue on GitHub](../../issues).\n\nEveryone is welcome regardless of personal background. We enforce a\n[Code of conduct](CODE_OF_CONDUCT.md) in order to promote a positive and\ninclusive environment.\n\n# Contributing\n\nThis project was made with ❤️. The simplest way to give back is by starring and\nsharing it online.\n\nIf the documentation is unclear or has a typo, please click on the page's `Edit`\nbutton (pencil icon) and suggest a correction.\n\nIf you would like to help us fix a bug or add a new feature, please check our\n[guidelines](CONTRIBUTING.md). Pull requests are welcome!\n\n\u003c!-- Thanks go to our wonderful contributors: --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START --\u003e\n\u003c!-- prettier-ignore --\u003e\n\u003c!--\n\u003ctable\u003e\u003ctr\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"https://fosstodon.org/@ehmicky\"\u003e\u003cimg src=\"https://avatars2.githubusercontent.com/u/8136211?v=4\" width=\"100px;\" alt=\"ehmicky\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eehmicky\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/ehmicky/wild-wild-parser/commits?author=ehmicky\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"#design-ehmicky\" title=\"Design\"\u003e🎨\u003c/a\u003e \u003ca href=\"#ideas-ehmicky\" title=\"Ideas, Planning, \u0026 Feedback\"\u003e🤔\u003c/a\u003e \u003ca href=\"https://github.com/ehmicky/wild-wild-parser/commits?author=ehmicky\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/table\u003e\n --\u003e\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fehmicky%2Fwild-wild-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fehmicky%2Fwild-wild-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fehmicky%2Fwild-wild-parser/lists"}