{"id":17472786,"url":"https://github.com/shinnn/append-type","last_synced_at":"2025-08-22T05:04:30.696Z","repository":{"id":57182735,"uuid":"70902289","full_name":"shinnn/append-type","owner":"shinnn","description":"Stringify the value with appending its type: 10 → '10 (number)'","archived":false,"fork":false,"pushed_at":"2019-01-22T12:21:17.000Z","size":71,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-09T01:35:05.696Z","etag":null,"topics":["error-messages","javascript","stringify","type"],"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-0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shinnn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-14T11:02:25.000Z","updated_at":"2019-01-22T12:20:38.000Z","dependencies_parsed_at":"2022-09-11T22:40:16.013Z","dependency_job_id":null,"html_url":"https://github.com/shinnn/append-type","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/shinnn/append-type","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fappend-type","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fappend-type/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fappend-type/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fappend-type/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shinnn","download_url":"https://codeload.github.com/shinnn/append-type/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fappend-type/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271588743,"owners_count":24785751,"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-08-22T02:00:08.480Z","response_time":65,"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":["error-messages","javascript","stringify","type"],"created_at":"2024-10-18T17:36:31.432Z","updated_at":"2025-08-22T05:04:30.668Z","avatar_url":"https://github.com/shinnn.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# append-type\n\n[![npm version](https://img.shields.io/npm/v/append-type.svg)](https://www.npmjs.com/package/append-type)\n[![Build Status](https://travis-ci.com/shinnn/append-type.svg?branch=master)](https://travis-ci.com/shinnn/append-type)\n[![Coverage Status](https://img.shields.io/coveralls/shinnn/append-type.svg)](https://coveralls.io/r/shinnn/append-type)\n\nStringify the value with appending its [type](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Operators/typeof): `10` → `'10 (number)'`\n\n```javascript\nimport appendType from 'append-type';\n\nappendType('123'); //=\u003e '123 (string)'\nappendType(123); //=\u003e '123 (number)'\n```\n\n## Installation\n\n[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/about-npm/).\n\n```\nnpm install append-type\n```\n\n## API\n\n```javascript\nimport appendType from 'append-type';\n```\n\n### appendType(*value*)\n\n*value*: any type  \nReturn: `string`\n\nEssentially, it returns `String(value) + ' (' + typeof value + ')'`.\n\n```javascript\nappendType(() =\u003e {}); //=\u003e '() =\u003e {} (function)'\n```\n\nWhen it takes `null` / `undefined`, it returns `'null'` / `'undefined'`.\n\n```javascript\nappendType(null); //=\u003e 'null'\nappendType(undefined); //=\u003e 'undefined'\n```\n\n## Example\n\nThis module is useful for making `TypeError` error messages.\n\n```javascript\nfunction reverse(v) {\n  if (typeof v !== 'boolean') {\n    throw new TypeError(`Expected a Boolean value, but got ${appendType(v)}.`);\n  }\n\n  return !v;\n};\n\nreverse(1); //=\u003e TypeError: Expected a Boolean value, but got 1 (number).\n```\n\n## License\n\n[MIT No Attribution](./LICENSE) © 2019 Shinnosuke Watanabe\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinnn%2Fappend-type","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshinnn%2Fappend-type","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinnn%2Fappend-type/lists"}