🐝🐜
BBO 是一款非常实用的JavaScript函数工具库。
当使用react,vue,angular进行前端开发时,通常需要编写许多utils方法。 但是lodash和underscore并不是万能的。 因此,开发中必须不断找到很多函数工具库。 通过使用bbo,您可以解决日常开发中的许多小问题,简单而紧凑!
每个前端开发人员都有自己的utils库, 这些方法我们高频使用,但又要在每个项目中重写。 bbo 是一款超小且实用的函数工具库,而且不同于 lodash underscore lazy.js.
我整理了日常开发中最常用的功能。 这些功能在您的开发中几乎无处不在,并且在一些主流的函数工具库中找不到。
大多数代码来自于高分答案中的stackoverflow.com 网站,向原始作者表示敬意。
项目在gzip压缩下只有9K, 所以你可以随时随地使用。
请参阅最新的文档 Documentation 以获取完整的API参考,或者在github上贡献bbo-docs文档。
使用npm
npm install bbo --save
...
import bbo from 'bbo';
let username = bbo.getCookie('username'); // 'bbo'
let json = cookie().getJson(); // {a: 1, b: 2}
let isiPhone = bbo.isiPhone(); //true or false
let isIphoneXmodel = bbo.isIphoneXmodel() // X XS, XSMax, XR
bbo.log('hello world!');
let id = bbo.setTimesout(function(word){
console.log(word);
console.log(this); // log {index: 3 ,times: 8, over: false}
}, 1000/20, 8, 'helloWorld')
bbo.math.numberFormat(1234.56, 2, ',', ' ') // '1 234,56'
依赖nodejs, 请使用terminal/iTerm安装环境
构建项目
git clone git://github.com/tnfe/bbo.git
...
npm install
npm run lint
npm run build
运行项目
npm run start
// 访问 http://localhost:8080
如果你想参与这个项目的共同创作,修改或添加内容,可以先 Fork 这本书的仓库,然后将修改的内容提交 Pull requests ;或者创建 Issues。
Fork 后的仓库如何同步本仓库?
# 添加 upstream 源,只需执行一次
git remote add upstream git@github.com:tnfe/bbo.git
# 拉取远程代码
git pull upstream master
# 提交修改
git add .
git commit
# 更新 fork 仓库
git push origin master
更多参考: Syncing a fork
这本书使用 Vuepress 撰写并生成网站,请查看文档仓库 package.json
中的 scripts
配置和 /docs
目录中的脚本来了解文档的构建和发布过程。
# 初始化 nodejs 依赖
npm install
# 安装 vuepress 插件
npm install -g vuepress
# 进入图书目录
cd docs
# 开始写作
vuepress dev .
# 构建静态文件
vuepress build .
# 查看本地文档内容
# 访问 http://localhost:8080
感谢所有为bbo做出贡献的人!
https://github.com/tnfe/bbo/graphs/contributors
ppo , ppo-cli , onavo , 30-seconds , locutus , mnu
Detailed changes for each release are documented in the release notes.
Bbo is released under the MIT License. http://www.opensource.org/licenses/mit-license