Code Monkey home page Code Monkey logo

merry.js's Introduction

merry.js

merry.js version build License Javascript version

"merry"取自海盗船黄金梅利号(Going Merry)中的merry。它是使用了ES6语法封装的一个能够解决常见问题的小型js库,或者说是工具类。

功能/参数

  • 禁止图片拖动imgPrevent:true/false(默认false

  • 解决低版本IE不能使用document.getElementByClassName()的问题,(默认开启)

  • 生成随机字符串`randomStr(length, dictionary)``,一共有两个参数:

    • length随机字符串的长度
    • dictionary,自定义字典,字符串类型。为空时使用默认字典:a-zA-Z0-9+=,共64位
  • 首字母大写capitalize(str)

  • 持续更新...

如何使用?

下载

git clone https://github.com/simmzl/merry.js.git

下载即用,无需安装依赖。

引用

script 引用

<script src="merry.min.js"></script>

import 引用

import Merry from "merry.min.js";

正式使用

你仅需新建一个Merry实例,即可设置相关参数并使用方法。

let my = new Merry({
    imgPrevent :true
});

// 从默认字典中生成100长度的随机字符串
my.randomStr(100);

// 从`“abcd1234”`中生成100长度的随机字符串
my.randomStr(100, "abcd1234");

// 首字母大写`capitalize(str)
my.capitalize("simmzl");
// Simmzl

merry.js's People

Contributors

simmzl avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.