1.4.2 • Published 4 years ago
bape v1.4.2
Bape - A Bathing Ape
Some useful Javascript functions and CSS style to reduce dumb work.
Inspired by Lodash.
Browser Support
Modern browsers and IE 11+
Installation
npm i bape --save
Example
// client
import random from 'bape/random'
random(0 , 1000) // generate a random integer number between 0 ~ 1000// server
const random = require('bape/random')
random(0 , 1000) // generate a random integer number between 0 ~ 1000API
Assertion
isObject(input)isPlainObject(input)isEmptyObject(input)isNumber(input)isJSON(input)isURL(input)
Cookie
cookie
Generate random things
random(min = 0, max = 100, floating = 0)randomString(length = 8)randomCnString(length = 8)
Others
isEnter(e)formatJSON(value, replacer = null, space = 2)safelyGet(obj, 'a.b[1].c.d[0].e')to get value from nested object without worring about error
Function
once(fn)noop()debounce(fn, wait, options)throttle(fn, wait, options)
Array
remove(arr, item)countArrayItem(arr)
EventEmitter
import EventEmitter from 'bape/events'
const event = new EventEmitter()
const removeListener = event.on('hello', () => console.log('hello'))
event.emit('hello')
removeListener()Style
.ape-text-ellipsisshow ... when text is too long.ape-centeruse flex layout to align child element center.ape-half-parent-width-squaregenerate a square that width is half of parent content width.ape-blur-text.ape-hidedisplay none.ape-clearfix
Dependency
1.4.2
4 years ago
1.4.1
4 years ago
1.4.0
4 years ago
1.3.1
5 years ago
1.3.0
5 years ago
1.2.0
6 years ago
1.1.10
6 years ago
1.1.9
6 years ago
1.1.8
6 years ago
1.1.7
6 years ago
1.1.6
6 years ago
1.1.5
6 years ago
1.1.4
6 years ago
1.1.3
6 years ago
1.1.2
6 years ago
1.1.1
6 years ago
1.1.0
6 years ago
1.0.9
6 years ago
1.0.8
6 years ago
1.0.7
6 years ago
1.0.6
6 years ago
1.0.5
6 years ago
1.0.4
6 years ago
1.0.3
6 years ago
1.0.2
6 years ago
1.0.1
6 years ago
1.0.0
6 years ago