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 🙏

© 2024 – Pkg Stats / Ryan Hefner

gy-common

v0.4.6

Published

gy

Downloads

16

Readme

$gyCom 共用方法

浮点数加减乘除(flortAdd/flortSub/flortMul/flortDiv)

params:
    num1 (Number), 
    num2 (Number)

格式化日期(formatTime)

params: 
    time: Date || string(时间格式)
    type: 'ymd' || 'hms' || 'y-m-d h:m:s'(自定义时间格式,y -> yy 年份取后两位)

判断是否是数字(isRealNum)

params: 
    val(排除空字符串和null的影响)

格式化科学计数法的数字(formatNum)

params: 
    number(数字太长在浏览器中会自动转换为科学计数法)

各种坐标系转换坐标(bd09togcj02/gcj02tobd09/wgs84togcj02/gcj02towgs84/bd09towgs84/wgs84tobd09)

params: 
    lon(经度)
    lat(纬度)
    //bd09百度   gcj02   wgs84

删除数组某个值(arrRemoveVal)

params: 
    arr(要删除的数组)
    val(值)

数组值为对象时,删除数组某个值(removeArray)

params: 
    _arr(要删除的数组)
    _obj(值)
    key(默认id)

添加水印(watermark)

params: 
    {   
        t1(第一行文字)
        t2(第二行文字)
        t3(第三行文字)
        id(父容器ID)
        defaultSettings(样式)
        intervalWidth(宽度)
        intervalheight(高度)
        isOne(是否只有一个)
    }

导出(daochuFun)

params: 
    fun(导出axios方法)
    searchKeys(参数)
    name(导出名字)

下载文件(downFileSuccFun)

params: 
    resp(相应主体)
    name(文件名)

获取指定日期所在的周一和周日的日期(getMonSunDate)

params: 
    nowDate(日期)

获取指定日期一周的日期数组(getWeekArr)

params: 
    nowDate(日期)

根据某个属性和值获取数组中的对象的指定值(getNameById)

params: 
    val(值)
    list(数组)
    idCoe(值的属性)
    namCol(指定属性)

表单验证(formDataValidator)

params: 
    formData(数据)
    validatorObj(验证规则)
        例:validatorObj: {
                'stationName': {
                  label: '常备名称',
                  prop: 'stationName',
                  required: true,
                  tyep: '',
                  len: '',  长度控制  
                  isInt: '' 是否整数  
                },
            },

格式日期(formatTime)

params: 
    time(时间)
    type(ymd/hms)
    customFormat(自定义格式)

计算两个日期的差,并转为中文(timeDifference)

params: 
    date(时间)
    date2(时间)
    timeDiff(需要去掉的时间)

格式图表数据(formatEchatsData)

params: 
    xData(时间数据数组)
    yData(值数组)
return 
    将日期转为小数并返回一个数组

将时分秒变成数字(formatHourToNum)

params: 
    time(时间)
    type(ymd/hms)
    customFormat(自定义格式)

tabel添加不同class(tableRowClassName)

    应用在element-ui表格上,添加 lightColor 和 darkColor class

克隆对象(cloneObj)

params: 
    obj

表格数据合并行(mergeTableRow)

params: 
    data
    merge(需要合并的属性数组)
表格添加  
      :span-method="$common.objectSpanMethod"

获取值数据类型(type)

params: 
    data

数组去重(unique)

params: 
    data

圣杯模式(inherit)

params: 
    data

获取URL上的参数(getUrlParam)

params: 
    sKey

添加className(addClass)

params: 
    sKey

判断有无className(hasClass)

params: 
    sKey

删除className(delClass)

params: 
    sKey

itowns模型方法

setCurve绘制管道

  setCurve(arr, texture = 'lineTexture', radius = 3, meshName, radiusSegments = 3, {
    optGroup, map, meshColor = false
  })
  params: 
    arr 多个point数组,
    texture 管道贴图 lineTexture or luwangTexture  or color色值(color色值需要options中 例: #fff)
    radius 管道半径
    meshName 管道group  name
    radiusSegments 管道截面
    {}  options
    optGroup   外部的group
    map       外部的mesh的贴图文件
        例: const dianlanImg = require('../../imgs/map/dianlan.png') 
            const map = new THREE.TextureLoader().load(dianlanImg);
    meshColor mesh是否适用纯色贴图 (需要配合texture, 将其设置为色值)

addRelitu 绘制热力图

  addRelitu(data, {
    fanwei,
    colorList,
    blurSize,
    pointSize,
    hei,
    valueMin = 0,
    valueMax = 1,
  } = {})
  params: 
    data        热力图数据   值为 [[lon, lat, value], ...]
    fanwei      热力图所需要显示的范围,   该范围需要四个经纬度,围成的正方形  点的顺序为 左上 右上, 左下 右下
    colorList   热力图 颜色渐变数据  第一个为最边缘的色值
    blurSize    热力图光晕范围
    pointSize   热力图点位大小
    hei         热力图所处高度
    valueMin    热力图最小值  可赋值为auto  即取data数组中的最小值
    valueMax    热力图最大值  可赋值为auto  即取data数组中的最大值

removeRelLiTu 移除热力图

    model.removeRelLiTu(id)

addSanDianTu 绘制散点图

  addSanDianTu(mapData, {
    fanwei,
    color = "rgb(255,0,0)",
    pointSize = 1,
    hei,
    eId = 'sanDianTuModelEcharts'
    symbolOpt = 1,
    valueMax = 'auto',
    valueMin = 'auto'
  } = {})
  params: 
    mapData     散点图数据   值为 [[lon, lat, value], ...]
    fanwei      散点图所需要显示的范围,   该范围需要四个经纬度,围成的正方形 点的顺序为 左上 右上, 左下 右下
    color       散点图 原点颜色
    pointSize   散点图点位大小倍数
    hei         散点图所处高度
    symbolOpt   散点的透明度
    valueMin    热力图最小值  可赋值为auto  即取data数组中的最小值
    valueMax    热力图最大值  可赋值为auto  即取data数组中的最大值

removeSanDianTu 移除散点图

    model.removeSanDianTu(id)

drowColorWeilan 绘制纯色围栏

drowColorWeilan(arr, name, opt){
    arr 经纬度数组
    name: 模型名称
    opt 
        {
            hei             模型距离地面高度
            wHeight         围栏高度
            color           围栏颜色
            colorOpacity    围栏颜色透明度
        }