内容简介:Simple utility which will returnThis package is available on NPM, and you can install it withAdd the
is-april-fools
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.
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
算法导论
[美] Thomas H. Cormen、Charles E. Leiserson、Ronald L. Rivest、Clifford Stein / 高等教育出版社 / 2002-5 / 68.00元
《算法导论》自第一版出版以来,已经成为世界范围内广泛使用的大学教材和专业人员的标准参考手册。 这本书全面论述了算法的内容,从一定深度上涵盖了算法的诸多方面,同时其讲授和分析方法又兼顾了各个层次读者的接受能力。各章内容自成体系,可作为独立单元学习。所有算法都用英文和伪码描述,使具备初步编程经验的人也可读懂。全书讲解通俗易懂,且不失深度和数学上的严谨性。第二版增加了新的章节,如算法作用、概率分析......一起来看看 《算法导论》 这本书的介绍吧!