{"id":16387714,"url":"https://github.com/shnhrrsn/as-type","last_synced_at":"2026-04-20T19:04:57.387Z","repository":{"id":57184547,"uuid":"62969333","full_name":"shnhrrsn/as-type","owner":"shnhrrsn","description":"Javascript type casting","archived":false,"fork":false,"pushed_at":"2020-10-21T02:37:59.000Z","size":8,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-14T22:36:32.017Z","etag":null,"topics":["casting","javascript","nodejs","typecast","types"],"latest_commit_sha":null,"homepage":null,"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/shnhrrsn.png","metadata":{"files":{"readme":"README.markdown","changelog":"CHANGELOG.markdown","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-07-09T21:11:19.000Z","updated_at":"2020-10-21T02:38:01.000Z","dependencies_parsed_at":"2022-09-14T08:50:30.562Z","dependency_job_id":null,"html_url":"https://github.com/shnhrrsn/as-type","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shnhrrsn%2Fas-type","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shnhrrsn%2Fas-type/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shnhrrsn%2Fas-type/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shnhrrsn%2Fas-type/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shnhrrsn","download_url":"https://codeload.github.com/shnhrrsn/as-type/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240171529,"owners_count":19759377,"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":["casting","javascript","nodejs","typecast","types"],"created_at":"2024-10-11T04:27:18.529Z","updated_at":"2026-04-20T19:04:52.346Z","avatar_url":"https://github.com/shnhrrsn.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003ca href=\"https://github.com/shnhrrsn/as-type/actions\"\u003e\u003cimg src=\"https://github.com/shnhrrsn/as-type/workflows/test/badge.svg\" alt=\"Build Status\"\u003e\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/package/as-type\"\u003e\u003cimg src=\"https://img.shields.io/npm/dt/as-type.svg\" alt=\"Total Downloads\"\u003e\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/package/as-type\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/as-type.svg\" alt=\"Latest Version\"\u003e\u003c/a\u003e\n\u003ca href=\"./LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/npm/l/as-type.svg\" alt=\"License\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n# as-type\n\nConvert undetermined data types to the type you want.\n\n### Installation\n\n```sh\nnpm install --save as-type\n```\n\n## Usage\n\n```js\nconst as = require('as-type')\n\nconsole.log(as.boolean('true')) // true\nconsole.log(as.boolean('t')) // true\nconsole.log(as.boolean('T')) // true\nconsole.log(as.boolean('yes')) // true\nconsole.log(as.boolean('y')) // true\nconsole.log(as.boolean('Y')) // true\nconsole.log(as.boolean(1)) // true\nconsole.log(as.boolean('asdf')) // false\nconsole.log(as.boolean(5)) // false\n\nconsole.log(as.integer('5')) // 5\nconsole.log(as.integer('5.5')) // 5\nconsole.log(as.integer('five')) // 0\n\nconsole.log(as.float('5')) // 5\nconsole.log(as.float('5.5')) // 5.5\nconsole.log(as.float('five')) // 0\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshnhrrsn%2Fas-type","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshnhrrsn%2Fas-type","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshnhrrsn%2Fas-type/lists"}