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

ulia

v1.3.6

Published

项目常用函数库

Downloads

61

Readme

项目常用函数库

函数库中含有的方法详细见右侧Keywords关键词

全部引用

  import * as ulia from 'ulia'

名 称:getTextTemplate

功 能:将字符串中的\n换行、\s空白字符替换成HTML换行标签、HTML实体空白字符 
 import { getTextTemplate } from 'ulia'
单独引用
 const getTextTemplate = require('ulia/lib/string/getTextTemplate')

名 称:getTemplateText

功 能:获取HTML模版字符串中的文本内容,并保留文本字符串中的\n换行、\s空白字符
 import { getTemplateText } from 'ulia'
单独引用
 const getTemplateText = require('ulia/lib/string/getTemplateText')

名 称:isWeixinBrowser

功 能:判断当前浏览器是否是微信浏览器
 import { isWeixinBrowser } from 'ulia'
单独引用
 const isWeixinBrowser = require('ulia/lib/boolean/isWeixinBrowser')

名 称:getStyle

功 能:
 import { getStyle } from 'ulia'
单独引用
 const getStyle = require('ulia/lib/dom/attr/getStyle')

名 称:random

功 能:随机数,第一个参数为最大限值,第二个参数为最小值,参数默认值为零
 import { random } from 'ulia'
单独引用
 const random = require('ulia/lib/number/random')

名 称:addChildNode

功 能:向指定元素插入dom节点,成功返回true
 import { addChildNode } from 'ulia'
单独引用
 const addChildNode = require('ulia/lib/dom/node/addChildNode')

名 称:removeNode

功 能:删除dom节点,成功返回true
 import { removeNode } from 'ulia'
单独引用
 const removeNode = require('ulia/lib/dom/node/removeNode')

名 称:cloneNode

功 能:克隆dom节点,成功返回克隆后的dom节点
 import { cloneNode } from 'ulia'
单独引用
 const cloneNode = require('ulia/lib/dom/node/cloneNode')

名 称:requestAnimationFrame

功 能:请求动画帧功能
 import { requestAnimationFrame } from 'ulia'
单独引用
 const requestAnimationFrame = require('ulia/lib/function/rewrite/requestAnimationFrame')

名 称:cancelAnimationFrame

功 能:取消动画帧功能
 import { cancelAnimationFrame } from 'ulia'
单独引用
 const cancelAnimationFrame = require('ulia/lib/function/rewrite/cancelAnimationFrame')

名 称:prefixStyle

功 能:使用js追加适配当前浏览器DOM对象样式属性前缀
 import { prefixStyle } from 'ulia'
 const animation = prefixStyle('animation')
 eleObject.style[animation]   = 'Ani 6s infinite'
 eleObject.style['animation'] = 'Ani 6s infinite'
备 注:在浏览器控制台里键入如下代码,查看当前浏览器前缀情况:
 document.createElement('div').style
单独引用
 const prefixStyle = require('ulia/lib/dom/style/prefixStyle')

名 称:isSupportWebP

功 能:判断当前浏览器是否支持WebP图片格式
 import { isSupportWebP } from 'ulia'
单独引用
 const isSupportWebP = require('ulia/lib/boolean/isSupportWebP')

名 称:zerofill

功 能:位数不足,前缀补零,默认两位数,第二个参数表示保留位数,非法参数一律返回 '00'
 import { zerofill } from 'ulia'
 zerofill(9) // '09'
 zerofill(66,3) // '066'
  ...
单独引用
 const zerofill = require('ulia/lib/number/zerofill')

名 称:quickSort

功 能:一维数字数组快速排序, 非一维数字数组一律返回空数组
 import { quickSort } from 'ulia'
单独引用
 const quickSort = require('ulia/lib/array/quickSort')

名 称:quickUnique

功 能:一维基本类型数据数组快速去重
 import { quickUnique } from 'ulia'
单独引用
 const quickUnique = require('ulia/lib/array/quickUnique')

名 称:parseQueryString

功 能:序列化对象url链接get参数 // 类似JSON.parse()
 import { parseQueryString } from 'ulia'
单独引用
 const parseQueryString = require('ulia/lib/string/parseQueryString')

名 称:stringfyQueryString

功 能:序反序列化满足get参数要求 // 类似JSON.stringfy()
 import { stringfyQueryString } from 'ulia'
单独引用
 const stringfyQueryString = require('ulia/lib/string/stringfyQueryString')

名 称:scrollToTop

功 能:返回顶部
 import { scrollToTop } from 'ulia'
单独引用
 const scrollToTop = require('ulia/lib/function/scrollToTop')

名 称:typeOf

功 能:完善typeof判断js数据类型的不足(含ES6新数据类型symbol)
 import { typeOf } from 'ulia'
 typeOf({}) // object
 typeOf([]) // array
 typeOf(Symbol()) // symbol
单独引用
 const typeOf = require('ulia/lib/other/typeOf')

名 称:transNumber

功 能:将js中任意数据类型转换成数字类型,NaN与Infinity归零处理
 import { transNumber } from 'ulia'
 transNumber(NaN) // 0
 transNumber(Infinity) // 0
 transNumber(1.1111) // 1.1111
 ...
单独引用
 const transNumber = require('ulia/lib/number/transNumber')

名 称:extend

功 能:拷贝任意对象属性,并操作
 import { extend } from 'ulia'
 extend(document.body.style, {
  backgroundColor: "red"
 })
单独引用
 const extend = require('ulia/lib/other/extend')

名 称:loadScript

功 能:减少script脚本HTTP请求
 import { loadScript } from 'ulia'
 loadScript('test.js', function() {
  <!-- Application.init() -->
  ...
 })
单独引用
 const loadScript = require('ulia/lib/other/loadScript')