{"id":15355801,"url":"https://github.com/fibo/not-defined","last_synced_at":"2025-07-04T09:07:42.604Z","repository":{"id":65411454,"uuid":"51136450","full_name":"fibo/not-defined","owner":"fibo","description":"checks if foo is not defined, i.e. undefined, null, an empty string, array, object or NaN","archived":false,"fork":false,"pushed_at":"2024-05-26T10:52:07.000Z","size":24,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-16T03:38:59.538Z","etag":null,"topics":[],"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/fibo.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":"2016-02-05T09:03:11.000Z","updated_at":"2025-03-08T11:24:35.000Z","dependencies_parsed_at":"2024-06-19T01:43:46.667Z","dependency_job_id":"07095346-2c7e-4bc1-b75b-0f4aefbb7c7e","html_url":"https://github.com/fibo/not-defined","commit_stats":{"total_commits":51,"total_committers":2,"mean_commits":25.5,"dds":0.05882352941176472,"last_synced_commit":"c3c92728f15618881d4ed162d30385d38b419f99"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/fibo/not-defined","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fibo%2Fnot-defined","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fibo%2Fnot-defined/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fibo%2Fnot-defined/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fibo%2Fnot-defined/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fibo","download_url":"https://codeload.github.com/fibo/not-defined/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fibo%2Fnot-defined/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260538237,"owners_count":23024756,"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-01T12:25:41.868Z","updated_at":"2025-07-04T09:07:42.459Z","avatar_url":"https://github.com/fibo.png","language":"JavaScript","readme":"# not-defined\n\n\u003e checks if foo is not defined, i.e. undefined, null, an empty string, array, object or NaN\n\n## Installation\n\n```bash\nnpm install not-defined\n```\n\n## Pros\n\n* Type less.\n* Better readability (even your boss will understand your code ^:).\n* Can save bytes in your builds.\n* Easier to autocomplete in editors (for instance easier than `typeof foo === 'undefined'`).\n\n## Usage\n\nThis snippet of code\n\n```javascript\nimport notDefined from 'not-defined'\n\nif (notDefined(foo)) {\n  // do something, usually throw a TypeError\n}\n```\n\nis equivalent to the following pseudocode\n\n```\nif (foo is not defined, i.e. is null, undefined, NaN, an empty string, array or object) {\n  // do something, usually throw a TypeError\n}\n```\n\nYou can also use a shorter but still semantic form like\n\n```javascript\nimport no from 'not-defined'\n\nif (no(foo)) {\n  // do something, usually throw a TypeError\n}\n```\n\nFollows a list of [tested examples](https://github.com/fibo/not-defined/blob/master/test.js)\n\n```javascript\nno() // true\nno(undefined) // true\nno(null) // true\nno('') // true\nno([]) // true\nno({}) // true\nno(NaN) // true\n\nno(0) // false\nno(true) // false\nno(false) // false\nno('string') // false\nno(['foo']) // false\nno({ foo: true }) // false\nno(42) // false\nno(Infinity) // false\nno(function () { return 1 }) // false\n```\n\n## License\n\n[MIT](http://g14n.info/mit-license)\n\n","funding_links":[],"categories":["模块","Modules"],"sub_categories":["其他","Other"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffibo%2Fnot-defined","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffibo%2Fnot-defined","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffibo%2Fnot-defined/lists"}