GithubHelp home page GithubHelp logo

vme50's Introduction

vme50

疯狂星期四,v me 50

来源

当然就是网上热火的 V 我 50 了。然后就想着收集一下表情包、文案放到仓库里,也是一个很无聊的项目……

之后会稍微写个后端,这样就可以直接调用 API 来调用这个仓库了。欢迎各位 PR 添加文案以及图片地址!数据链接

周四调用 vme50 的时候会报错:

Error: Crazy Thursday need ¥50

文档

打包的时候有带 .d.ts 文件,理论上支持 TypeScript 这里就只展示 TypeScript 代码示例

安装

npm install vme50

vme50

import vme50 from 'vme50'

// 如果今天是星期四,你会收获一条报错:Error: Crazy Thursday need ¥50
// 并且返回疯狂星期四文案一篇
vme50()

vme50(options?: Options) 接收 options 作为可选参数,参数声明如下

interface Options {
  console?: boolean              // 默认为 false
  type?: 'warn' | 'error'        // 默认为 error
  returnUndefined?: boolean      // 默认为 true
  resultType?: 'text' | 'image'  // 默认为 text
}
  1. type 参数为 warn,则在星期四的时候会调用 console.warn('Warning: Crazy Thursday need ¥50'),此时 console 参数的值将忽略
  2. type 参数为 errorconsolefalse 在星期四将会直接 throw 'Error: Crazy Thursday need ¥50',若 consoletrue 则只会 console.error('Error: Crazy Thursday need ¥50')
  3. returnUndefined 参数为 true 则不在星期四的时候将会返回 undefined,若为 false 会根据 resultType 返回文案或图片链接
  4. resultType 参数为 text,将会返回文案,为 image 将会返回图片链接
  5. 请注意,如果函数已经 throw 了之后肯定就没有返回值了,即当星期四的时候 consoletruetypeerror 时,returnUndefinedresultType 都是没有用的

vme50Text 和 vme50Image

import { vme50Text, vme50Image } from 'vme50'

console.log(vme50Text())  // 随机返回一条疯狂星期四文案
console.log(vme50Image()) // 随机返回一条疯狂星期四图片链接

vme50's People

Contributors

rotten-lkz avatar

Stargazers

 avatar  avatar  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.