1.5.0 • Published 3 years ago

@parrotjs/which-type v1.5.0

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

一、支持环境

二、node环境使用 (已通过测试√)

npm install --save @parrotjs/which-type  //安装npm包
//index.js
const { isTypeUndefined,isTypeArray,isTypeNumber,isTypeObject } =require('@parrotjs/which-type');

console.log(isTypeUndefined()) // true

console.log(isTypeArray([])) // true

console.log(isTypeNumber(0)) // true

console.log(isTypeObject({})) // true

三、浏览器环境使用

1.HTML中使用 (已通过测试√)

//使用upk在线cdn
https://unpkg.com/@parrotjs/which-type@1.3.0/index.js
//使用jsdelivr在线cdn
https://cdn.jsdelivr.net/npm/@parrotjs/which-type@1.3.0/index.js
//index.html
<!DOCTYPE html>
<html>
    <head></head>
    <body>
        <script src="https://cdn.jsdelivr.net/npm/@parrotjs/which-type@1.3.0/index.js" ></script>
        <script>
            console.log(whichType.isTypeUndefined()) // true

            console.log(whichType.isTypeArray([])) // true

            console.log(whichType.isTypeNumber(0)) // true

            console.log(whichType.isTypeObject({})) // true
        </script>
    </body>
</html>

2.ESM中使用 (已通过测试√)

import { isTypeUndefined, isTypeArray, isTypeNumber, isTypeObject } from '@parrotjs/which-type';

console.log(isTypeUndefined()) // true

console.log(isTypeArray([])) // true

console.log(isTypeNumber(0)) // true

console.log(isTypeObject({})) // true

四、github源码地址

https://github.com/parrot-design/parrot-utils/tree/main/which-type

五、版本变更记录

  • 1.0.0 初始化目录
  • 1.1.0 README.md修改添加ESM使用方式
  • 1.2.0 README.md修改
  • 1.3.0 README.md修改
  • 1.4.0 增加String支持

六、使用场景

某些场景下需要判断变量的类型

1.5.0

3 years ago

1.4.0

3 years ago

1.3.0

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago