???? is-april-fools - A micro-library for checking if it's April 1st

栏目: IT技术 · 发布时间: 5年前

内容简介:Simple utility which will returnThis package is available on NPM, and you can install it withAdd the

is-april-fools

:tada: Micro library to check if it is April 1st.

Simple utility which will return true if the current date is April 1st. This allows your app/program/script/system to do something on April fools (such as conditionally showing some April fools joke UI).

Installation

This package is available on NPM, and you can install it with npm or yarn :

npm install is-april-fools

yarn add is-april-fools

Add the -S flag if you want to save it to the "dependencies" section of your package.json .

Browser/UMD

If you want to just import this library directly in the browser, you can add the following script tag:

<script src="https://unpkg.com/is-april-fools/lib/index.umd.js" />

This will expose a isAprilFools function in the global scope.

Usage

import isAprilFools from 'is-april-fools';

if (isAprilFools()) {
    console.log(':tada: Happy April Fools!');
} else {
    console.log(':disappointed: Just another boring day...');
}

Note

This package uses the current date from the machine it is running on, meaning if this is running on a server or in a lambda somewhere, you may get unexpected results or some weird edge cases.

Contributing

Feel free to file an issue or open a pull request.

:ok_hand: Built by Dave Lunny in the wonderful year 2019.


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

C语言深度解剖

C语言深度解剖

陈正冲 / 北京航空航天大学出版社 / 2010-7 / 29.00元

《C语言深度解剖:解开程序员面试笔试的秘密》由作者结合自身多年嵌入式c语言开发经验和平时讲解C语言的心得体会整理而成,其中有很多作者独特的见解或看法。由于并不是从头到尾讲解C语言的基础知识,所以《C语言深度解剖:解开程序员面试笔试的秘密》并不适用于C语言零基础的读者,其内容要比一般的C语言图书深得多、细致得多,其中有很多问题是各大公司的面试或笔试题。 《C语言深度解剖:解开程序员面试笔试的秘......一起来看看 《C语言深度解剖》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

随机密码生成器
随机密码生成器

多种字符组合密码

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换