{"id":15617049,"url":"https://github.com/uncenter/detect-formatting","last_synced_at":"2026-01-07T13:53:53.261Z","repository":{"id":214006948,"uuid":"735430158","full_name":"uncenter/detect-formatting","owner":"uncenter","description":"🔍 Detect the indentation, newline style, quotes style, and usage of semicolons of a JavaScript file.","archived":false,"fork":false,"pushed_at":"2024-03-01T01:36:31.000Z","size":123,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T11:50:39.966Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/detect-formatting","language":"TypeScript","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/uncenter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING.md","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":"2023-12-24T22:46:10.000Z","updated_at":"2024-06-30T18:37:26.000Z","dependencies_parsed_at":"2023-12-25T04:54:04.007Z","dependency_job_id":"7617569a-c4ae-4868-b4e3-05147a931ca5","html_url":"https://github.com/uncenter/detect-formatting","commit_stats":null,"previous_names":["uncenter/detect-formatting"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uncenter%2Fdetect-formatting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uncenter%2Fdetect-formatting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uncenter%2Fdetect-formatting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uncenter%2Fdetect-formatting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uncenter","download_url":"https://codeload.github.com/uncenter/detect-formatting/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246201913,"owners_count":20739848,"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-03T07:41:12.873Z","updated_at":"2026-01-07T13:53:53.222Z","avatar_url":"https://github.com/uncenter.png","language":"TypeScript","readme":"# detect-formatting\n\nDetect the indentation, newline style, quotes style, and usage of semicolons of a JavaScript file.\n\n## Installation\n\n```sh\nnpm i detect-formatting\npnpm add detect-formatting\nyarn add detect-formatting\nbun add detect-formatting\n```\n\n## Usage\n\n```ts\nimport { detectIndent, detectNewline, detectSemicolon, detectQuotes } from 'detect-formatting';\nimport { readFileSync } from 'node:fs';\n\nconst file = readFileSync('index.js', 'utf-8');\n\ndetectIndent(file);\n// { type: 'space' | 'tab', amount: number, indent: string } | undefined\ndetectNewline(file);\n// { type: 'lf' | 'crlf', newline: '\\n' | '\\r\\n' } | undefined\ndetectSemicolon(file);\n// boolean | undefined\ndetectQuotes(file);\n// { type: 'single' | 'double', quotes: \"'\" | '\"' } | undefined\n```\n\n## License\n\n[MIT](LICENSE)\n\n\u003e [!NOTE]\n\u003e The `detectIndent()` and `detectNewline()` functions are largely based on Sindre Sorhus' packages, [`detect-indent`](https://github.com/sindresorhus/detect-indent) and [`detect-newline`](https://github.com/sindresorhus/detect-newline). Licences for the two can be found in [`COPYING.md`](COPYING.md).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funcenter%2Fdetect-formatting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funcenter%2Fdetect-formatting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funcenter%2Fdetect-formatting/lists"}