is-0
v1.3.0
Published
Check if parameter is empty.
Maintainers
Readme
is
값이 empty인지 확인하는 단순하고 강력한 함수를 제공합니다.
Installation
npm install is-0먼저 .npmrc 파일을 생성하거나 수정하세요:
@SangHakLee:registry=https://npm.pkg.github.com그리고 GitHub Personal Access Token으로 인증:
npm login --scope=@SangHakLee --registry=https://npm.pkg.github.com패키지 설치:
npm install @SangHakLee/is-0Usage
JavaScript (CommonJS)
const is = require('is-0')
console.log(is.empty('')) // true
console.log(is.empty([])) // true
console.log(is.empty({})) // true
console.log(is.empty(null)) // true
console.log(is.empty(undefined)) // true
console.log(is.empty('hello')) // false
console.log(is.empty([1, 2, 3])) // false
console.log(is.empty({ a: 1 })) // falseTypeScript
import * as is from 'is-0'
const value: any = ''
if (is.empty(value)) {
console.log('Value is empty')
}API
is.empty(value: any): boolean
주어진 값이 "empty"인지 확인합니다.
Empty로 판단되는 값:
- 빈 문자열:
'',new String(),`` - 빈 배열:
[],new Array() - 빈 객체:
{},new Object() nullundefined
Empty가 아닌 값:
is.empty(1) // false - 숫자
is.empty('string') // false - 문자열
is.empty([1]) // false - 배열 (요소 있음)
is.empty({a: 1}) // false - 객체 (프로퍼티 있음)
is.empty(true) // false - boolean
is.empty(false) // false - boolean
is.empty(new Date()) // false - Date 객체
is.empty(new Map()) // false - Map 객체특수 케이스:
is.empty(new Proxy({}, {})) // true - 빈 Proxy는 empty로 판단더 많은 예제는 ./test/datas/empty.ts를 참고하세요.
is.isEmpty(value: any): boolean
is.empty()의 별칭입니다. 동일하게 동작합니다.
Development
Requirements
- Node.js ≥ 20.0.0
- npm ≥ 10.0.0
Contributing
기여를 환영합니다! 자세한 내용은 CONTRIBUTING.md를 참고하세요.
License
MIT © SangHak Lee

