jm-utils

utils

Usage no npm install needed!

<script type="module">
  import jmUtils from 'https://cdn.skypack.dev/jm-utils';
</script>

README

jm-utils

utils

参数转换

undefined 值不转换,直接返回undefined

  • arg2bool

参数值转换为布尔值

'true', true, >0的数字和数字串 转为 true

其他转为false

  • arg2number

参数值转换为数字值

'true', true 转为 1

数字串直接转数字

其他都转为0