{"id":17677438,"url":"https://github.com/unadlib/be-type","last_synced_at":"2025-07-05T20:11:28.489Z","repository":{"id":86376587,"uuid":"104466928","full_name":"unadlib/be-type","owner":"unadlib","description":"be-type is based on ECMAScript2015+ proxy feature","archived":false,"fork":false,"pushed_at":"2017-09-28T16:24:44.000Z","size":43,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-16T22:54:08.706Z","etag":null,"topics":["typecheck"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/unadlib.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-22T11:27:05.000Z","updated_at":"2018-11-21T16:28:22.000Z","dependencies_parsed_at":"2023-07-11T14:34:03.809Z","dependency_job_id":null,"html_url":"https://github.com/unadlib/be-type","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"707d1fba2b56887a1b2be92c6b0409b4601c3c25"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/unadlib/be-type","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unadlib%2Fbe-type","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unadlib%2Fbe-type/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unadlib%2Fbe-type/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unadlib%2Fbe-type/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unadlib","download_url":"https://codeload.github.com/unadlib/be-type/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unadlib%2Fbe-type/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263800061,"owners_count":23513435,"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":["typecheck"],"created_at":"2024-10-24T07:28:41.866Z","updated_at":"2025-07-05T20:11:28.449Z","avatar_url":"https://github.com/unadlib.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# be-type\nbe-type is based on ECMAScript2015+ proxy feature\n\n[![Travis](https://img.shields.io/travis/unadlib/be-type.svg)](https://travis-ci.org/unadlib/be-type)\n[![Coverage Status](https://coveralls.io/repos/github/unadlib/be-type/badge.svg?branch=master)](https://coveralls.io/github/unadlib/be-type?branch=master)\n[![npm](https://img.shields.io/npm/v/be-type.svg)](https://www.npmjs.com/package/be-type)\n[![npm](https://img.shields.io/npm/dt/be-type.svg)](https://www.npmjs.com/package/be-type)\n[![npm](https://img.shields.io/npm/l/be-type.svg)](https://www.npmjs.com/package/be-type)\n\n### Usage\n```bash\nyarn add be-type\nnpm install --save be-type\n```\nJavaScript:\n```javascript\nimport be from 'be-type';\nbe.function(()=\u003e{}); // true\n```\nCustom type check:\n```javascript\n//be.js\nimport be,{setBe} from 'be-type';\nexport default setBe({\n    Negative:(value)=\u003e be.Number(negative) \u0026\u0026 negative \u003c 0\n})\n//other.js\nimport be from '../be.js';\nbe.Negative(-1); // true\n```\n\n### API\n\n#### Interface Rule:\n\n1. If the first letter of the API is **lowercase**, then it refers to toString.call(value), the type returned by call.\n\n\u003e be.function(()=\u003e{}) `equivalent` toString.call(()=\u003e{}) ==== \"[object Function]\"\n\n\u003e be.generatorFunction(function* (){}) `equivalent` toString.call(function* (){}) ==== \"[object GeneratorFunction]\"\n\n\u003e be.uint8Array(new Uint8Array()) `equivalent` toString.call(new Uint8Array()) ==== \"[object Uint8Array]\"\n\u003e etc..\n\n2. if the first letter of the API is **Uppercase**, it means not toString.call(value), Custom type returned by call\n\n#### Default built-in type check:\n\n| Interface     |    Spec                                   |\n| :------------ | -----------------------------------------:|\n| Function      |  plain function                           |\n| Object        |  plain object                             |\n| String        |  basic string                             |\n| Number        |  basic number                             |\n| Boolean       |  basic boolean                            |\n| NaN           |  strict equality to `NaN`                 |\n| Nil           |  `null` or `undefined`                    |\n| Empty         |  none length                              |\n| Infinity      |  strict equality to `Infinity`            |\n| Finite        |  basic number and not `NaN` or `Infinity` |\n| Native        |  pristine native function                 |\n| SafeInteger   |  based on Number.isSafeInteger            |\n| Integer       |  based on Number.isInteger                |\n| Element       |  HTML Element                             |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funadlib%2Fbe-type","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funadlib%2Fbe-type","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funadlib%2Fbe-type/lists"}