{"id":18644095,"url":"https://github.com/indix/javascript-easy-object","last_synced_at":"2025-04-11T12:30:54.054Z","repository":{"id":57279553,"uuid":"83182193","full_name":"indix/javascript-easy-object","owner":"indix","description":"Now easily access or modify an object in javascript with javascript-easy-object.","archived":false,"fork":false,"pushed_at":"2017-08-28T09:49:38.000Z","size":20,"stargazers_count":13,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-19T20:16:03.243Z","etag":null,"topics":["javascript","javascript-objects","object","traversal","traversal-patterns"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/indix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-26T04:15:17.000Z","updated_at":"2019-01-03T10:48:50.000Z","dependencies_parsed_at":"2022-09-18T09:10:51.039Z","dependency_job_id":null,"html_url":"https://github.com/indix/javascript-easy-object","commit_stats":null,"previous_names":["manishwaran/javascript-easy-object"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indix%2Fjavascript-easy-object","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indix%2Fjavascript-easy-object/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indix%2Fjavascript-easy-object/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indix%2Fjavascript-easy-object/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/indix","download_url":"https://codeload.github.com/indix/javascript-easy-object/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248401934,"owners_count":21097328,"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","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":["javascript","javascript-objects","object","traversal","traversal-patterns"],"created_at":"2024-11-07T06:09:57.150Z","updated_at":"2025-04-11T12:30:53.731Z","avatar_url":"https://github.com/indix.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Javascript Easy Object (JEO)\nA module for handling all the action related to object in one step with multi pattern traversal.\n\n### Traversal Patterns\n* Direct method :\nThis is direct access to value through the path string separated by the delimitor during the JEO object initialization.\nEg. For accessing the value `e` in the object `{ a: 'b', c: { d: 'e' } }`, you can use path as `a\\\\.c\\\\.d`\nIn above the delimitor is `\\\\.` which is the default value. You can change it by passing delimitor that you want during JEO object initialization.\n\n* Filter method :\nThis method allows you to pick certain key or pattern in the object.\nEg.\n```\nobject :\n\n{\n  a: {\n    v: 'a',\n    b: {\n      z: 'z1'\n    },\n    c: {\n      z: 'z2'\n    },\n    d: {\n      z: 'z3\n    }\n  }\n}\n\npath : a.[b,d].z\n\noutput: ['z1', 'z3']\n\n```\n\n* One level skip method :\nThis method allows you to skip a level and search for the pattern that you want.\nEg.\n```\nobject :\n\n{\n  a: {\n    v: 'a',\n    b: {\n      z: 'z1'\n    },\n    c: {\n      z: 'z2'\n    },\n    d: {\n      z: 'z3\n    }\n  }\n}\n\npath : a.?.z\n\noutput : ['z1', 'z2', 'z3']\n\n```\n\n* Any level skip method :\nThis method allows you to pick the value for pattern without even knowing the path.\nEg.\n```\nobject :\n\n{\n  a: {\n    v: 'a',\n    b: {\n      z: 'z1'\n    },\n    c: {\n      z: 'z2'\n    },\n    d: {\n      z: 'z3\n    }\n  }\n}\n\npath : *.z\n\noutput: ['z1', 'z2', 'z3', 'z4']\n\n```\n### Usage\nAbove patterns can be composed with each other or can be used separately as per your need. With the above patterns you can do following actions :\n```\n     1. Get\n     2. Put\n     3. Delete\n     4. Rename\n     5. Get path\n```\nGet, put, delete method are well known actions. Rename action allows you to rename the key that is present in the object. Get-path allows you to specify any path traversal and it will return the path from root to the found element. Its return type is array of string(if more than one value found on traversal it will return all paths for those values).\n\nGet has `isSafe` option which lets to return value or null safely instead of getting error on unknown path. Its default value is false. It is the third option in get function.\n\nsnippet :\n```\nimport JEO from 'javascript-easy-object'\n\nconst jeo = new JEO('.') //delimitor value is optional. Default value is '\\\\.'\nconst values = jeo.get(object, path, true) // 3rd param is for isSafe mode\nconst modifiedObject = jeo.put(object, path, value)\nconst propertyDeletedObject = jeo.delete(object, path)\nconst renamedObject = jeo.rename(object, path, newName)\nconst paths = jeo.getPath(object, path)\n```\n\n### Conclusion\nMore options in JEO and patterns for traversal will be released in future. If you're interested to contribute, please feel free to fork and send in a Pull Request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findix%2Fjavascript-easy-object","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Findix%2Fjavascript-easy-object","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findix%2Fjavascript-easy-object/lists"}