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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@babyeye/mixjs

v2.0.0

Published

babyeyefe tool

Downloads

9

Readme

函数

数学函数

babyEye.randomRange(low,high)

  • 返回[low,high)中的一个随机整数

babyEye.randomExcept(low, high, except)

  • 返回[low,high)中的一个随机整数,但不会是except

babyEye.shuffle(arr)

  • 洗牌,打乱了arr里面元素顺序

babyEye.rangeArr(min,max,step)

  • 返回一个数组,从min到max,区间[min,max)
  • 相邻相差step,默认step为1

babyEye.constrain(value,min,max)

  • 如果value在[min,max] 之间返回value,否则返回与value相近的值

babyEye.map(value,minSource,maxSouce,minTarget,maxTarget)

  • value的范围是[minSource,maxSource]
  • 返回value在[minTarget, maxTarget]的映射值

babyEye.selectFrom(arr, num)

  • 从数组arr中随机选取num个元素,返回值是一个数组

babyEye.isMobile()

  • 返回bool, 判断是否为移动设备

babyEye.Button(img ,callbackDown, callbackUp)

  • 图片,按下的回调函数,抬起时候的回调函数
  • 返回一个bitmap

babyEye.randomChoice(arr)

  • 随机返回arr中的一个元素

图像函数

过滤图片颜色 babyEye.ImageFiltered(img, filters)

// 返回一张处理过的图片
new babyEye.ImageFiltered(img, filters)

// img是加载的图片,filters是createjs的filters 如:
new createjs.ColorFilter(1,0,0,1,255,0,0,0)

产生立体式图片一 ImageSTE({image:img, colors:["r","b"], delta:10})

// 返回值是一个处理后的图片,左边只有红通道,右边没有红通道,delta是错位的距离像素
new ImageSTE({image:img, colors:["r","b"], delta:10})

产生立体式图片二 ImageSTE2({image:img, colors:["r","b"], delta:10})

// 返回值是一个处理后的图片,左边只有红通道,右边没有蓝通道,与上一个区别,差了一个绿通道
new ImageSTE2({image:img, colors:["r","b"], delta:10})

产生立体式图片 ImageMidSTE({image:img, colors:["r","b"], delta:10})

// 返回值是一个处理后的图片,只有中间部分有像素,两边是透明的
new ImageMidSTE({image:img, colors:["r","b"], delta:10})

babyEye.getImagePoints(image,resolution=30,regular=false)

  • 图片,分辨率,规则化点
  • 返回一个数组,里面的元素是{x: number,y:number} 对象,一组为image的形状的点

babyEye.Page 具体用法参见 Space/an725 用来简化开始结束页面

备忘录

~~es6 module~~
~~commonJS~~
npm: 开发更好用的 JavaScript 模块