{"id":20678608,"url":"https://github.com/v-core9/v_is_empty_value","last_synced_at":"2025-10-20T01:13:40.577Z","repository":{"id":40267438,"uuid":"426722941","full_name":"V-core9/v_is_empty_value","owner":"V-core9","description":"https://www.npmjs.com/package/v_is_empty_value","archived":false,"fork":false,"pushed_at":"2024-02-02T04:11:40.000Z","size":268,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main_index","last_synced_at":"2025-02-19T19:40:49.703Z","etag":null,"topics":["date","emptyvaluechecker","isempty","javascript","js","nodejs","null","object"],"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/V-core9.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":"2021-11-10T17:56:06.000Z","updated_at":"2024-02-02T04:21:39.000Z","dependencies_parsed_at":"2025-01-17T15:15:28.016Z","dependency_job_id":"7177fbae-dbaa-4f97-853e-76fdafd4bb14","html_url":"https://github.com/V-core9/v_is_empty_value","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/V-core9%2Fv_is_empty_value","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/V-core9%2Fv_is_empty_value/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/V-core9%2Fv_is_empty_value/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/V-core9%2Fv_is_empty_value/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/V-core9","download_url":"https://codeload.github.com/V-core9/v_is_empty_value/tar.gz/refs/heads/main_index","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242911233,"owners_count":20205457,"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":["date","emptyvaluechecker","isempty","javascript","js","nodejs","null","object"],"created_at":"2024-11-16T21:21:13.882Z","updated_at":"2025-10-20T01:13:40.440Z","avatar_url":"https://github.com/V-core9.png","language":"JavaScript","readme":"# 👨‍💻 v_is_empty_value\n\nSimple checker for Empty/NotEmpty values. Checking Numbers, Null, NaN, Strings, Objects, Arrays...Will also detect instance of Date() object and return \"not-empty\" value for it.\n\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/c7b2d814ac52490cbd96320824a4cea8)](https://app.codacy.com/gh/V-core9/v_is_empty_value?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=V-core9/v_is_empty_value\u0026utm_campaign=Badge_Grade_Settings)\n[![CodeQL](https://github.com/V-core9/v_is_empty_value/actions/workflows/codeql.yml/badge.svg)](https://github.com/V-core9/v_is_empty_value/actions/workflows/codeql.yml)\n[![njsscan sarif](https://github.com/V-core9/v_is_empty_value/actions/workflows/njsscan.yml/badge.svg)](https://github.com/V-core9/v_is_empty_value/actions/workflows/njsscan.yml)\n\n## General Information\n\nIt provides 4 functions to check if a value is empty or not.\nThese are named as follows:\n\n- `isEmpty(v)` : Checks if a value is empty. Returns true if the value is empty, else false.\n- `isNotEmpty(v)` : Checks if a value is not empty. Returns true if the value is not empty, else false.\n- `isEmptyNested(v)` : Checks if a nested value is empty.\n  - It will check nested values in Objects and Arrays.\n  - It will use recursion to check nested values.\n  - Uses `isEmpty(v)` to check if a value is empty under the hood.\n  - Returns true if the nested value is empty, else false.\n- `isNotEmptyNested(v)` : Checks if a nested value is not empty. Returns true if the nested value is not empty, else false.\n  \u003e NOTE: This basically does the opposite of `isEmptyNested(v)`.\n\n### Base Example\n\n```js\n// import { isEmpty, isNotEmpty, isEmptyNested, isNotEmptyNested } from 'v_is_empty_value'\nconst { isEmpty, isNotEmpty, isEmptyNested, isNotEmptyNested } = require('v_is_empty_value')\n\nisEmpty(v) // Checks if a value is empty.\n\nisNotEmpty(v) // Checks if a value is not empty.\n\nisEmptyNested(v) // Checks if a nested value is empty.\n\nisNotEmptyNested(v) // Checks if a nested value is not empty.\n```\n\n### ☑ Things it confirms **Empty**\n\n- **Undefined / Empty**\n\n```js\nconsole.log(isEmpty()) // prints \"true\"\nconsole.log(isNotEmpty()) // prints \"false\"\n```\n\n- **Empty String**\n\n```js\nconsole.log(isEmpty('')) // prints \"true\"\nconsole.log(isNotEmpty('')) // prints \"false\"\n```\n\n- **null**\n\n```js\nconsole.log(isEmpty(null)) // prints \"true\"\nconsole.log(isNotEmpty(null)) // prints \"false\"\n```\n\n- **Undefined**\n\n```js\nconsole.log(isEmpty(undefined)) // prints \"true\"\nconsole.log(isNotEmpty(undefined)) // prints \"false\"\n```\n\n- **Empty Object**\n\n```js\nconsole.log(isEmpty({})) // prints \"true\"\nconsole.log(isNotEmpty({})) // prints \"false\"\n```\n\n- **Empty Array**\n\n```js\nconsole.log(isEmpty([])) // prints \"true\"\nconsole.log(isNotEmpty([])) // prints \"false\"\n```\n\n### ☑ Few things it confirms **NOT Empty**\n\n- **String** with some length/value.\n\n```js\nisEmpty('demo_password_123456') // prints \"false\"\nisNotEmpty('demo_password_123456') // prints \"true\"\n```\n\n- **NaN**\n\n```js\nconsole.log(isEmpty(NaN)) // prints \"false\"\nconsole.log(isNotEmpty(NaN)) // prints \"true\"\n```\n\n- **Date** _instance_.\n\n```js\nisEmpty(new Date()) // prints \"false\"\nisNotEmpty(new Date()) // prints \"true\"\n```\n\n- **Error** _instance_.\n\n```js\nisEmpty(new Error()) // prints \"false\"\nisNotEmpty(new Error()) // prints \"true\"\n```\n\n- **Promise** _instance_.\n\n```js\nisEmpty(new Promise((resolve, reject) =\u003e resolve(true))) // prints \"false\"\nisNotEmpty(new Promise((resolve, reject) =\u003e resolve(true))) // prints \"true\"\n```\n\n- **Number** _instance_.\n\n```js\nconsole.log(Number()) // prints \"0\"\nconsole.log(isEmpty(Number())) // prints \"false\"\nconsole.log(isNotEmpty(Number())) // prints \"true\"\n```\n\n\u003e Note: It will return `false` for `0` and `-0` as well.\n\n- **Nested Object** : confirms not empty even though it has empty values.\n\n```js\nconst nestedEmptyObject = {\n  demo: null,\n  yea: undefined,\n  iKnowMan: {\n    wtf: null,\n    moreNull: null\n  }\n}\n\n// NOTE: Returns \"false\" just because \"iKnowMan\" is an object.\nconsole.log(isEmpty(nestedEmptyObject)) // prints \"false\"\nconsole.log(isNotEmpty(nestedEmptyObject)) // prints \"true\"\n\n// NOTE: Better use \"isEmptyNested(v)\" to check nested values.\nconsole.log(isEmptyNested(nestedEmptyObject)) // prints \"true\"\nconsole.log(isNotEmptyNested(nestedEmptyObject)) // prints \"false\"\n```\n\n\u003e 📜 **More Info:**  \n\u003e Check the [test cases](./__tests__/data/test_items.js) for more examples.\n\n---\n\n### **🚀 Performance Benchmark**\n\nThis will basically run the functions mentioned for 25mil. times and will print the time taken for each function to complete.\n\n### 📋 Test setup:\n\n- AMD Ryzen 7 2700X Eight-Core Processor 3.70 GHz\n- 16 GB 3000 MHz DDR4\n- Patriot P300 256GB M.2 NVMe\n- Windows 10 Pro 64-bit\n- Node.js v20.10.0\n\n### 📊 Current performance:\n\n- `isEmpty(v)` : ~ **40,000** ops/ms [ **40** mil. ops/sec ]\n- `isNotEmpty(v)` : ~ **32,000** ops/ms [ **32** mil. ops/sec ]\n- `isEmptyNested(v)` : ~ **30,000** ops/ms [ **30** mil. ops/sec ]\n- `isNotEmptyNested(v)` : ~ **31,000** ops/ms [ **31** mil. ops/sec ]\n\n---\n\n📑 Related links :\n\n- [v_to_md5](https://www.npmjs.com/package/v_to_md5) ⏭ MD5 hash generator\n- [v_to_sha256](https://www.npmjs.com/package/v_to_sha256) ⏭ sha256 hash generator\n- [v_file_system](https://www.npmjs.com/package/v_file_system) ⏭ simple and safe fs module with sync and promises\n- [v_execute](https://www.npmjs.com/package/v_execute) ⏭ Exec cli commands\n- [v_scrolls](https://www.npmjs.com/package/v_scrolls) ⏭ Readme Generator\n- [v_database](https://www.npmjs.com/package/v_database) ⏭ single database solution\n- [v_database_cli](https://www.npmjs.com/package/v_database_cli) ⏭ v_database cli tool\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fv-core9%2Fv_is_empty_value","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fv-core9%2Fv_is_empty_value","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fv-core9%2Fv_is_empty_value/lists"}