{"id":16367964,"url":"https://github.com/ephys/dotenv-parser-serializer","last_synced_at":"2025-06-26T01:02:48.568Z","repository":{"id":57215432,"uuid":"137935835","full_name":"ephys/dotenv-parser-serializer","owner":"ephys","description":"dotfile \u003c=\u003e JS Object parser/serializer","archived":false,"fork":false,"pushed_at":"2024-07-03T14:14:54.000Z","size":74,"stargazers_count":2,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-04T11:47:03.198Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ephys.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-19T19:25:07.000Z","updated_at":"2024-07-08T13:04:07.000Z","dependencies_parsed_at":"2024-10-28T15:22:45.371Z","dependency_job_id":null,"html_url":"https://github.com/ephys/dotenv-parser-serializer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ephys/dotenv-parser-serializer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ephys%2Fdotenv-parser-serializer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ephys%2Fdotenv-parser-serializer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ephys%2Fdotenv-parser-serializer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ephys%2Fdotenv-parser-serializer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ephys","download_url":"https://codeload.github.com/ephys/dotenv-parser-serializer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ephys%2Fdotenv-parser-serializer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261978908,"owners_count":23239417,"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-10-11T02:51:17.875Z","updated_at":"2025-06-26T01:02:48.475Z","avatar_url":"https://github.com/ephys.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# envfile (dotenv) parser / serialize\n\n*An envfile parser written in javascript*\n\n## Usage\n\n`npm install dotenv-parser-serializer`\n\nParsing:\n\n```javascript\nimport { parse } from 'dotenv-parser-serializer';\n\n// parse transforms the contents of an envfile into a JSON object\n\nconst envfileContents = `\n\n# Retrieve your public key at\n# https://my-public-key.fr\nSERVER_PUBLIC_KEY=f4dfneihfrhei\nSERVER_PRIVATE_KEY=\"dewhifewgif4dfneihfrhei\"\n\n`;\n\nassert.equal(\n  parse(envfileContents),\n  // output:\n  {\n    SERVER_PUBLIC_KEY: 'f4dfneihfrhei',\n    SERVER_PRIVATE_KEY: 'dewhifewgif4dfneihfrhei',\n  }\n);\n\n// You can extract comments and use them as descriptions using the `extractDescriptions` option\n\nassert.equal(\n  parse(envfileContents, { extractDescriptions: true }),\n  // output:\n  {\n    SERVER_PUBLIC_KEY: {\n      value: 'f4dfneihfrhei',\n      description: 'Retrieve your public key at\\nhttps://my-public-key.fr',\n    },\n    SERVER_PRIVATE_KEY: {\n      value: 'dewhifewgif4dfneihfrhei',\n      description: null,\n    },\n  }\n);\n```\n\nSerializing:\n\n\n```javascript\nimport { serialize } from 'dotenv-parser-serializer';\n\n// serialize transforms an object of key =\u003e values into a string.\n\nassert.equal(\n  serialize({\n    SERVER_PUBLIC_KEY: 'f4dfneihfrhei',\n    SERVER_PRIVATE_KEY: 'dewhifewgif4dfneihfrhei',\n  }),\n  // output:\n  `SERVER_PUBLIC_KEY=f4dfneihfrhei\n\nSERVER_PRIVATE_KEY=\"dewhifewgif4dfneihfrhei\"`\n);\n\n// You can insert comments in the file by providing an object containing a \"description\" property instead of a string.\n\nassert.equal(\n  serialize({\n    SERVER_PUBLIC_KEY: 'f4dfneihfrhei',\n    SERVER_PRIVATE_KEY: {\n      description: `My private key\\nIt's secret`,\n      value: 'dewhifewgif4dfneihfrhei',\n    },\n  }),\n  `SERVER_PUBLIC_KEY=f4dfneihfrhei\n\n# My private key\n# It's secret\nSERVER_PRIVATE_KEY=\"dewhifewgif4dfneihfrhei\"`\n);\n```\n\n\n## Envfile syntax\n\nThe envfile may contain the following syntax (PR welcome if more support is needed):\n\n- Any line starting with `#` is a comment\n- The others should be in the format `\u003ckey\u003e=\u003cvalue\u003e` where\n  - `key` is string matching the following format: `/[a-zA-Z_\\-]+[0-9a-zA-Z_\\-]*/`\n  - `value` is a either a \"quoted string\" or \"unquoted string\"\n\nA quoted string is a string surrounded by double quotes:  \n`MY_KEY=\"my value\"`\n\nA quoted string may contain escaped characters such as \\n, \\f, \\r, \\b, \\\", \\\\, \\t and can be multiline\n\n\nAn unquoted string is a string that does not start with a double quote:\n`MY_KEY=my value`\n\nAn unquoted string cannot be multiline and cannot contain escaped characters.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fephys%2Fdotenv-parser-serializer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fephys%2Fdotenv-parser-serializer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fephys%2Fdotenv-parser-serializer/lists"}