npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

lx-ui-j

v0.1.16

Published

``` /** * [PROP description] * @type {Object} */ export const PROP = { string: { type: String, 'default': '' }, strDef (def = '', required = false) { if (typeof def !== 'string' && typeof def !== 'function') { console.error('pro

Readme

ffe-rollup

/**
 * [PROP description]
 * @type {Object}
 */
export const PROP = {
  string: {
    type: String,
    'default': ''
  },
  strDef (def = '', required = false) {
    if (typeof def !== 'string' && typeof def !== 'function') {
      console.error('props属性默认值类型要求为string/function, 得到的为' + typeof def)
    }
    return {
      type: String,
      required,
      'default': def
    }
  },
  boolean: {
    type: Boolean,
    'default': false
  },
  boolDef (def = false, required = false) {
    if (typeof def !== 'boolean' && typeof def !== 'function') {
      console.error('props属性默认值类型要求为boolean, 得到的为' + typeof def)
    }
    return {
      type: Boolean,
      required,
      'default': def
    }
  },
  numDef (def = null, required = false) {
    return {
      type: Number,
      required,
      'default': def
    }
  },
  anyDef (def = '', required = false) {
    return {
      required,
      'default': def
    }
  },
  objDef (def = {}, required = false) {
    return {
      type: Object,
      required,
      'default': typeof def === 'function' ? def : () => def
    }
  },
  arrDef (def = [], required = false) {
    return {
      type: Array,
      required,
      'default': typeof def === 'function' ? def : () => def
    }
  }
}


/**
 * [debounce 防抖]
 * @param  {Function} fn    [description]
 * @param  {Number}   delay [description]
 * @return {[type]}         [用户输入结束或暂停时,才会触发change事件]
 */
export function debounce(fn, delay = 500) {
  let timer = null

  return function() {
    if (timer) {
      clearTimeout(timer)
    }

    timer = setTimeout(() => {
      fn.apply(this, arguments)
      timer = null
    }, delay)
  }
}

/**
 * [throttle 节流]
 * @param  {Function} fn    [description]
 * @param  {Number}   delay [description]
 * @return {[type]}         [无论你拖拽多快,都会在每隔100ms触发一次]
 */
export function throttle(fn, delay = 100) {
  let timer = null
  return function() {
    if (timer) {
      return
    }

    timer = setTimeout(() => {
      fn.apply(this, arguments)
      timer = null
    }, delay)
  }
}

/**
 * [获取区间日期]
 * @param  {[type]} diffDay [天数]
 * 比如返回创建时间: 最近七天
 * @return {[type]}     [description]
 */
export const getStart2EndDiffDay = (diffDay) => {
  const end = new Date(new Date().setHours(23, 59, 59, 0))
  const start = new Date()
  start.setTime(start.setHours(0, 0, 0, 0) - 3600 * 1000 * 24 * diffDay)

  return [start, end]
}

/**
 * [dataType 封装type]
 * // 要求:
// type([]) -> array
// type({}) -> object
// type(function) -> function
// type(new Number()) -> number Object
// type(123) -> number

 * @param  {[type]} target [description]
 * @return {[type]}        [description]
 */
export function dataType(target) {
  // 1. 分析 原始值和引用值
  // 2. 如果是引用值,分析是
  var template = {
    '[object Array]': 'array',
    '[object Object]': 'object',
    '[object Number]': 'number - object',
    '[object Boolean]': 'boolean - object',
    '[object String]': 'string - object'
  }

  var ret = typeof(target)

  if (target === null) {
    return 'null'
  } else if (ret == 'object') {
    // 引用值
    var str = Object.prototype.toString.call(target)
    return template[str]
  } else {
    // 原始值
    return ret
  }
}

/**
 * [校验是否为0]
 * @param  {[type]} num [description]
 * @return {[type]}     [description]
 */
export const isZero = num => {
  return num === '0' || num === 0
}

/**
 * 判断一个组件是否在页面中可见
 * @param cp vue组件实例
 * @returns {boolean}
 */
export function isVisibleComponent (cp) {
  if (!cp || !cp.$el) return false
  const rect = cp.$el.getBoundingClientRect()
  return !(rect.width === 0 && rect.height === 0)
}


// 支持的timer: sellerList、warehouseList
export const Timer = {
  _time: 5, // 时间戳(单位:s)
  abc: null,
  setSellerList: () => {

  },
  setTimer (key = '') {
    if (!key) {
      key = key.replace(/\b\w/g, function (th) {
        return th.toUpperCase()
      })
      this['set' + key]()
    } else {

    }
  },
  getTimer (key = '') {
    if (!key) {
      key = key.replace(/\b\w/g, function (th) {
        return th.toUpperCase()
      })
      this['get' + key]()
    } else {

    }
  }
}

'mixin': 'lx-ui-j/dist/mixin', // 混合模式
'systemTheme': 'lx-ui-j/dist/system_theme.js', // 主题
'webLog': './src/util/weblog.js', // api-错误上报
'calcHash': './src/util/api_hash.js', // api_hash
'download': './src/downloadJs/index.js', // downloadjs
'Print': './src/util/print.js', // print打印
'Arms': './src/util/arms.js', // arms监控-仅生产环境
'Watermark': './src/util/watermark.js', // 水印
'Directive': './src/directive/index.js', // 自定义指令
'erp-bus': './src/bus/erp.js', // erp-bus文件
'boss-bus': './src/bus/boss.js', // boss-bus文件
'scm-bus': './src/bus/scm.js', // scm-bus文件
'wms-bus': './src/bus/wms.js', // wms-bus文件
'index': './src/util/util.js' // 公共工具文件