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

riku-verycloud

v1.2.2

Published

vue components and functions for verycloud projects

Readme

Utils 常用小工具

arrayToTree

import {arrayToTree} from 'riku-verycloud'

将数组转化为树状数组

const data = [
	{id: 1, name: 'A'},
	{id: 2, name: 'B', parent: 1},
	{id: 3, name: 'C', parent: 2}
]
const tree = arrayToTree(data, {parent: 'parent'})
/*
[{
  _raw: {id: 1, name: 'A'},
  label: 'A',
  value: 1,
  children: [
    {
      _raw: {id: 2, name: 'B', parent: 1},
      label: 'B',
      value: 2,
      children: [
        {
          _raw: {id: 3, name: 'C', parent: 2},
          label: 'C',
          value: 3,
          children: []
        }
      ]
    }
  ]
}]
*/

|options|类型|默认值 |:----|:----|:---|:----|

|label|string|"name"| |value|string|"id"| |parent|string|"parent_id"| |labelProp|string|"label"| |valueProp|string|"value"| |childrenProp|string|"children"|

byteSize

import {byteSize} from 'riku-verycloud'
// 字节格式化
byteSize(2048)
// {value: "2.0", unit: "KB"}

byteSize('2048').toString()
// "2.0 KB"

byteSize('2048', {units: 'metric', precision: 2}).toString()
// "2.05 kB"

|options|类型|可选值|说明|默认值| |:----|:----|:---|:---|:----| |units|string|"metric", "iec", "metric_octet", "iec_octet"|单位|"iec" |precision|number||小数点保留位数|1|

cookie

import {cookie} from 'riku-verycloud'
// cookie的相关操作
// setup
document.cookie = 'foo=1'
document.cookie = 'bar=2'

cookie.get('foo')
// "1"

cookie.get('bar', function (s) { return parseInt(s) })
// 2

cookie.set('foo', 3)

cookie.set('bar', 4, {
  domain: 'example.com',
  path: '/',
  expires: 30
})

cookie.remove('foo')

cookie.remove('bar', {
  domain: 'example.com',
  path: '/'
})

dateFormat

import {dateFormat} from 'riku-verycloud'
// 日期格式化
dateFormat(new Date(), 'YYYY-MM-DD HH:mm:ss')

debounce

import {debounce} from 'riku-verycloud'
debounce(fn, 3000)

throttle

import {throttle} from 'riku-verycloud'
throttle(fn, 3000)

number

import {number} from 'riku-verycloud'

comma

// 分割数字,默认为3位分割,一般用于格式化金额

number.comma(21342132)
// “21,342,132”

numberComma('21342132', 4)
// “2134,2132”

pad

//用于按照位数补0,默认2位
number.pad(1)
// “01”
number.pad(234, 4)
// “0234”

random

// 生成2个数字之间的随机数
number.random(1, 7)
// 2

range

// 生成两个数之间的数组成的数组,补位默认2
number.range(1, 10)
// ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10"]

queryString

import {queryString} from 'riku-verycloud'
// url 参数解析
queryString.parse('a=b&c=d')
// {a: “b”, c: “d”}

queryString.stringify({a: 'b', c: 'd'})
// “a=b&c=d”

stringTrim

import {stringTrim} from 'riku-verycloud'
// 去除字符串前后空格
stringTrim(' 1024 ')
// “1024”

thisDay

import {ThisDay} from 'riku-verycloud'
// time要能被new Date()解析,不传或解析不成功则为当天日期
new ThisDay(time)
/*
{
  monthEndDate: "2018/04/30",
  monthStartDate: "2018/04/01",
  quarterEndDate: "2018/06/30",
  quarterStartDate: "2018/04/01",
  today: "2018/04/16",
  tomorrow: "2018/04/17",
  weekEndDate: "2018/04/22",
  weekStartDate: "2018/04/16",
  yearEndDate: "2018/12/31",
  yearStartDate: "2018/01/01"
}
*/

组件

// 全局注册
import verycloud from 'riku-verycloud'
Vue.use(verycloud)

Qrcode 二维码

// 单独引用
import {RQrcode} from 'riku-verycloud'

|属性|说明|类型|默认值| |:----|:----|:----|:----| |text|二维码的文字内容|String|-| |size|尺寸,同时设置宽和高,优先级低于widthheight|Number|128| |width|宽|Number|128| |height|高|Number|128| |dark|渲染前景色|String|"#000"| |light|渲染背景色|String|"#FFF"| |level|容错级别,可选"L", "M", "Q", "H"|String|"H"|