{"id":36967430,"url":"https://github.com/keift/typof","last_synced_at":"2026-05-20T23:06:46.313Z","repository":{"id":329034403,"uuid":"1117688773","full_name":"keift/typof","owner":"keift","description":"Infer types.","archived":false,"fork":false,"pushed_at":"2025-12-28T19:34:40.000Z","size":145,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-31T10:53:20.505Z","etag":null,"topics":["array","boolean","date","float","integer","number","object","string","type","typeof"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/typof","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/keift.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-16T17:10:03.000Z","updated_at":"2025-12-28T19:32:10.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/keift/typof","commit_stats":null,"previous_names":["keift/typof"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/keift/typof","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keift%2Ftypof","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keift%2Ftypof/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keift%2Ftypof/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keift%2Ftypof/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/keift","download_url":"https://codeload.github.com/keift/typof/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keift%2Ftypof/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28399512,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T14:36:09.778Z","status":"ssl_error","status_checked_at":"2026-01-13T14:35:19.697Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["array","boolean","date","float","integer","number","object","string","type","typeof"],"created_at":"2026-01-13T20:03:40.455Z","updated_at":"2026-05-20T23:06:46.277Z","avatar_url":"https://github.com/keift.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[Types]: ./src/types/types.ts\n[UnknownObject]: ./src/types/unknown_object.ts\n\n\u003cdiv align=\"center\"\u003e\n  \u003cbr/\u003e\n  \u003cimg src=\"./assets/logo.png\" width=\"350px\"/\u003e\n  \u003cbr/\u003e\n  \u003cbr/\u003e\n  \u003cimg src=\"https://img.shields.io/npm/v/typof?label=version\u0026color=615fff\"/\u003e\n  \u003cimg src=\"https://img.shields.io/npm/l/typof?label=license\u0026color=615fff\"/\u003e\n  \u003cimg src=\"https://img.shields.io/npm/dt/typof?label=downloads\u0026color=00bc7d\"/\u003e\n  \u003cimg src=\"https://img.shields.io/npm/unpacked-size/typof?label=size\u0026color=00bc7d\"/\u003e\n\u003c/div\u003e\n\n## Contents\n\n- [About](#about)\n- [Features](#features)\n- [Installation](#installation)\n- [Documentation](#documentation)\n  - [Tree](#tree)\n  - [Import](#import)\n  - [Methods](#methods)\n  - [Types](#types)\n- [Links](#links)\n  - [Discord](https://discord.gg/keift)\n  - [Telegram](https://t.me/keiftco)\n  - [Twitter](https://x.com/keiftco)\n  - [GitHub](https://github.com/keift)\n- [License](#license)\n\n## About\n\nInfer types.\n\n## Features\n\n- Infers multiple types\n- Infers integer and float types\n- Infers the type from a string\n- There are simple type converters\n\n## Installation\n\nYou can install it as follows.\n\n```shell\n# NPM\nnpm add typof\n\n# PNPM\npnpm add typof\n\n# Yarn\nyarn add typof\n\n# Bun\nbun add typof\n\n# Deno\ndeno add typof\n```\n\n## Documentation\n\n### Tree\n\nBriefly as follows.\n\n```typescript\ntypof\n│\n├── typof(value)\n├── string(value)\n├── number(value)\n├── integer(value)\n├── float(value)\n├── boolean(value)\n├── date(value)\n├── object(value)\n├── array(value)\n├── _null(value)\n├── _undefined(value)\n│\n├── type Types\n└── type UnknownObject\n```\n\n### Import\n\nBriefly as follows.\n\n```typescript\nimport { typof } from 'typof';\n```\n\n### Methods\n\n`typof(value)`\n\nInfer types.\n\n\u003e | Parameter | Type    | Default | Description           |\n\u003e | --------- | ------- | ------- | --------------------- |\n\u003e | `value`   | Unknown |         | Value to infer types. |\n\u003e\n\u003e returns [Types]\\[]\n\u003e\n\u003e Example:\n\u003e\n\u003e ```typescript\n\u003e // Tests are as follows. (Is this an integer?)\n\u003e if (typof(0).includes('integer')) console.log('This is an integer.');\n\u003e\n\u003e // Index zero always ensures reliable type checking. As the index increases, species depth also increases.\n\u003e if (typof('0.5')[0] === 'string') console.log('This is a string.');\n\u003e\n\u003e typof('test'); // ['string']\n\u003e\n\u003e typof('0'); // ['string', 'number', 'integer']\n\u003e typof(0); // ['number', 'integer']\n\u003e\n\u003e typof('0.5'); // ['string', 'number', 'float']\n\u003e typof(0.5); // ['number', 'float']\n\u003e\n\u003e typof('true'); // ['string', 'boolean']\n\u003e typof(true); // ['boolean']\n\u003e\n\u003e typof('2025-01-01'); // ['string', 'date']\n\u003e typof(new Date('2025-01-01')); // ['date', 'object']\n\u003e\n\u003e typof('{\"key\":\"value\"}'); // ['string', 'object']\n\u003e typof({ key: 'value' }); // ['object']\n\u003e\n\u003e typof('[\"test\"]'); // ['string', 'array']\n\u003e typof(['test']); // ['array']\n\u003e\n\u003e typof('null'); // ['string', 'null']\n\u003e typof(null); // ['null']\n\u003e\n\u003e typof('undefined'); // ['string', 'undefined']\n\u003e typof(undefined); // ['undefined']\n\u003e ```\n\n\u003cbr/\u003e\n\n`string(value)`\n\nConvert to string.\n\n\u003e | Parameter | Type    | Default | Description       |\n\u003e | --------- | ------- | ------- | ----------------- |\n\u003e | `value`   | Unknown |         | Value to convert. |\n\u003e\n\u003e returns String\n\u003e\n\u003e Example:\n\u003e\n\u003e ```typescript\n\u003e string(0.5); // '0.5'\n\u003e string(true); // 'true'\n\u003e string(new Date('2025-01-01')); // '2025-01-01T00:00:00.000Z'\n\u003e string({ key: 'value' }); // '{\"key\":\"value\"}'\n\u003e string(['test']); // '[\"test\"]'\n\u003e string(null); // 'null'\n\u003e string(undefined); // 'undefined'\n\u003e ```\n\n\u003cbr/\u003e\n\n`number(value)`\n\nConvert to number.\n\n\u003e | Parameter | Type    | Default | Description       |\n\u003e | --------- | ------- | ------- | ----------------- |\n\u003e | `value`   | Unknown |         | Value to convert. |\n\u003e\n\u003e returns Number\n\u003e\n\u003e Example:\n\u003e\n\u003e ```typescript\n\u003e number('0.5'); // 0.5\n\u003e number(0.5); // 0.5\n\u003e number('test'); // NaN\n\u003e ```\n\n\u003cbr/\u003e\n\n`integer(value)`\n\nConvert to integer.\n\n\u003e | Parameter | Type    | Default | Description       |\n\u003e | --------- | ------- | ------- | ----------------- |\n\u003e | `value`   | Unknown |         | Value to convert. |\n\u003e\n\u003e returns Number\n\u003e\n\u003e Example:\n\u003e\n\u003e ```typescript\n\u003e integer('0.5'); // 0\n\u003e integer(0.5); // 0\n\u003e integer('test'); // NaN\n\u003e ```\n\n\u003cbr/\u003e\n\n`float(value)`\n\nConvert to float.\n\n\u003e | Parameter | Type    | Default | Description       |\n\u003e | --------- | ------- | ------- | ----------------- |\n\u003e | `value`   | Unknown |         | Value to convert. |\n\u003e\n\u003e returns String | Value\n\u003e\n\u003e Example:\n\u003e\n\u003e ```typescript\n\u003e float('0', 2); // '0.00'\n\u003e float(0, 2); // '0.00'\n\u003e float(0.1234, 2); // '0.12'\n\u003e float(0.1234, 4); // '0.1234'\n\u003e float('test'); // 'test'\n\u003e ```\n\n\u003cbr/\u003e\n\n`boolean(value)`\n\nConvert to boolean.\n\n\u003e | Parameter | Type    | Default | Description       |\n\u003e | --------- | ------- | ------- | ----------------- |\n\u003e | `value`   | Unknown |         | Value to convert. |\n\u003e\n\u003e returns Boolean | Value\n\u003e\n\u003e Example:\n\u003e\n\u003e ```typescript\n\u003e boolean('true'); // true\n\u003e boolean(true); // true\n\u003e boolean('test'); // 'test'\n\u003e ```\n\n\u003cbr/\u003e\n\n`date(value)`\n\nConvert to date.\n\n\u003e | Parameter | Type    | Default | Description       |\n\u003e | --------- | ------- | ------- | ----------------- |\n\u003e | `value`   | Unknown |         | Value to convert. |\n\u003e\n\u003e returns Date | Value\n\u003e\n\u003e Example:\n\u003e\n\u003e ```typescript\n\u003e date('2025-01-01'); // 2025-01-01T00:00:00.000Z\n\u003e date(new Date('2025-01-01')); // 2025-01-01T00:00:00.000Z\n\u003e date('test'); // 'test'\n\u003e ```\n\n\u003cbr/\u003e\n\n`object(value)`\n\nConvert to object.\n\n\u003e | Parameter | Type    | Default | Description       |\n\u003e | --------- | ------- | ------- | ----------------- |\n\u003e | `value`   | Unknown |         | Value to convert. |\n\u003e\n\u003e returns [UnknownObject] | Value\n\u003e\n\u003e Example:\n\u003e\n\u003e ```typescript\n\u003e object('{\"key\":\"value\"}'); // { key: 'value' }\n\u003e object('[\"test\"]'); // '[\"test\"]'\n\u003e ```\n\n\u003cbr/\u003e\n\n`array(value)`\n\nConvert to array.\n\n\u003e | Parameter | Type    | Default | Description       |\n\u003e | --------- | ------- | ------- | ----------------- |\n\u003e | `value`   | Unknown |         | Value to convert. |\n\u003e\n\u003e returns Unknown\\[] | Value\n\u003e\n\u003e Example:\n\u003e\n\u003e ```typescript\n\u003e array('[\"test\"]'); // ['test']\n\u003e array('{\"key\":\"value\"}'); // '{\"key\":\"value\"}'\n\u003e ```\n\n\u003cbr/\u003e\n\n`_null(value)`\n\nConvert to null.\n\n\u003e | Parameter | Type    | Default | Description       |\n\u003e | --------- | ------- | ------- | ----------------- |\n\u003e | `value`   | Unknown |         | Value to convert. |\n\u003e\n\u003e returns Null | Value\n\u003e\n\u003e Example:\n\u003e\n\u003e ```typescript\n\u003e _null('null'); // null\n\u003e _null(null); // null\n\u003e _null('test'); // 'test'\n\u003e ```\n\n\u003cbr/\u003e\n\n`_undefined(value)`\n\nConvert to undefined.\n\n\u003e | Parameter | Type    | Default | Description       |\n\u003e | --------- | ------- | ------- | ----------------- |\n\u003e | `value`   | Unknown |         | Value to convert. |\n\u003e\n\u003e returns Undefined | Value\n\u003e\n\u003e Example:\n\u003e\n\u003e ```typescript\n\u003e _undefined('undefined'); // undefined\n\u003e _undefined(undefined); // undefined\n\u003e _undefined('test'); // 'test'\n\u003e ```\n\n### Types\n\n| Type            |\n| --------------- |\n| [Types]         |\n| [UnknownObject] |\n\n## Links\n\n- [Discord](https://discord.gg/keift)\n- [Telegram](https://t.me/keiftco)\n- [Twitter](https://x.com/keiftco)\n- [GitHub](https://github.com/keift)\n\n## License\n\nMIT License\n\nCopyright (c) 2025 Keift\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeift%2Ftypof","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkeift%2Ftypof","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeift%2Ftypof/lists"}