{"id":21401463,"url":"https://github.com/spoonx/field-string-parser","last_synced_at":"2025-03-16T16:16:30.037Z","repository":{"id":57235231,"uuid":"120752252","full_name":"SpoonX/field-string-parser","owner":"SpoonX","description":"A field-string parser","archived":false,"fork":false,"pushed_at":"2018-02-08T11:38:14.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-25T04:17:34.647Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SpoonX.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-08T11:22:05.000Z","updated_at":"2018-02-08T11:37:33.000Z","dependencies_parsed_at":"2022-09-04T21:20:39.657Z","dependency_job_id":null,"html_url":"https://github.com/SpoonX/field-string-parser","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpoonX%2Ffield-string-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpoonX%2Ffield-string-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpoonX%2Ffield-string-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpoonX%2Ffield-string-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SpoonX","download_url":"https://codeload.github.com/SpoonX/field-string-parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243893897,"owners_count":20364919,"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":[],"created_at":"2024-11-22T15:27:57.186Z","updated_at":"2025-03-16T16:16:30.017Z","avatar_url":"https://github.com/SpoonX.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Field string parser\n\nA library that consumes strings and converts them into string definitions.\n\nAdditionally, it formats and adds an argument string for easy code generating.\n\n## Installation\n\n`npm i --save field-string-parser` or `yarn add field-string-parser`\n\n## Usage\n\nUsage is pretty straight forward. You can reuse instances, or use the static method.\n\nFields can be passed in using JSON, or the [ezon](https://github.com/SpoonX/ezon) format.\n\nExamples of valid formats:\n\n`'username,password:(size:50),active:boolean'`\n\nor\n\n`'username:string,password:field(size:50),active:field(type:boolean)'`\n\n### Static example\n\nHere's an example using the static parse method.\n\n```js\nconst parsedFields = FieldStringParser.parse('username,password:(size:50),active:boolean');\n\nconsole.log(parsedFields);\n\n// Generates the following\n{\n  username: {\n    argumentString: '{ type: \\'string\\' }',\n    definition    : { type: 'string' }\n  },\n  password: {\n    argumentString: '{ size: 50, type: \\'string\\' }',\n    definition    : { size: 50, type: 'string' }\n  },\n  active  : {\n    argumentString: '{ type: \\'boolean\\' }',\n    definition    : { type: 'boolean' }\n  }\n}\n```\n\n### Instance example\n\nHere's an example using the instance approach.\n\n```js\nconst fieldParser  = new FieldParser('username,password:(size:50),active:boolean');\nconst parsedFields = fieldStringParser.parse();\n\nconsole.log(parsedFields);\n\n// Generates the following\n{\n  username: {\n    argumentString: '{ type: \\'string\\' }',\n    definition    : { type: 'string' }\n  },\n  password: {\n    argumentString: '{ size: 50, type: \\'string\\' }',\n    definition    : { size: 50, type: 'string' }\n  },\n  active  : {\n    argumentString: '{ type: \\'boolean\\' }',\n    definition    : { type: 'boolean' }\n  }\n}\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspoonx%2Ffield-string-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspoonx%2Ffield-string-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspoonx%2Ffield-string-parser/lists"}