Giter Club home page Giter Club logo

is.js's Introduction

is.js


https://github.com/arasatasaygin/is.js

var customName = is.setNamespace();
customName.odd(3);

is.url('https://www.duckduckgo.com');

is.setRegexp(/quack/, 'url');
is.url('auack');

var firstQuarter = new Date('01/26/2015');
var secondQuarter = new Date('05/26/2015');
is.quarterOfYear(firstQuarter, 1);
is.quarterOfYear(secondQuarter, 1);
is.not.quarterOfYear(secondQuarter, 1);

var january1 = new Date('01/01/2015');
var june1 = new Date('06/01/2015');
is.dayLightSavingTime(june1);
is.dayLightSavingTime(june1);
is.dayLightSavingTime(january1);
is.not.dayLightSavingTime(january1);

var tenDaysLater = new Date(new Date().setDate(new Date().getDate() + 10));
var fortyDaysLater = new Date(new Date().setDate(new Date().getDate() + 40));
is.inNextMonth(tenDaysLater);
is.inNextMonth(fortyDaysLater);
is.not.inNextMonth(fortyDaysLater);

var twoMonthsLater = new Date(new Date().setMonth(new Date().getMonth() + 2));
var thirteenMonthsLater = new Date(new Date().setMonth(new Date().getMonth() + 13));
is.inNextYear(twoMonthsLater);
is.inNextYear(thirteenMonthsLater);
is.not.inNextYear(thirteenMonthsLater);

var twoMonthAgo = new Date(new Date().setMonth(new Date().getMonth() - 2));
var thirteenMonthsAgo = new Date(new Date().setMonth(new Date().getMonth() - 13));
is.inLastYear(twoMonthsAgo);
is.inLastYear(thirteenMonthsAgo);
is.not.inLastYear(thirteenMonthsAgo);

var twoDaysLater = new Date(new Date().setDate(new Date().getDate() + 2));
var nineDaysLater = new Date(new Date().setDate(new Date().getDate() + 9));
is.inNextWeek(twoDaysLater);
is.inNextWeek(nineDaysLater);
is.not.inNextWeek(nineDaysLater);

var getArguments = function(){
  return arguments;
};
var arguments = getArguments();
is.arguments(arguments);
is.not.arguments({foo: 'bar'});
is.not.arguments(aruguments, 'bar');
is.any.arguments(['foo'], arguments);
is.all.arguments([arguments, 'foo', 'bar']);

is.array(['foo', 'bar', 'baz']);
is.not.array({foo: 'bar'});
is.all.array(['foo'], 'bar');
is.any.array(['foo'], 'bar');
is.all.array([[1, 2] 'foo', 'bar']);

is.boolean(true);
is.not.boolean({foo: 'bar'});
is.all.boolean(true, 'bar');
is.any.boolean(true, 'bar');
is.all.boolean([true, 'foo', 'bar']);

is.date(new Date());
is.not.date({foo: 'bar'});
is.all.date(new Date(), 'bar');
is.any.date(new Date(), 'bar');
is.all.date([new Date(), 'foo', 'bar']);

var year2015 = new Date('01/26/2015');
var year2016 = new Date('01/26/2016');
is.year(year2015, 2015);
is.year(year2016, 2015);
is.not.year(year2016, 2015);

is.leapYear(2016);
is.leapYear(2015);
is.not.leapYear(2015);
is.all.leapYear(2015, 2016);
is.any.leapYear(2015, 2016);
is.all.leapYear([2016, 2080]);

var monday = new Date('01/26/2015');
var sunday = new Date('01/25/2015');
var saturday = new Date('01/24/2015');
is.weekend(sunday);
is.weekend(monday);
is.not.weekend(sunday, saturday);
is.not.weekend(sunday, saturday, monday);
is.all.weekend([sunday, saturday, monday]);
npm install is_js
bower install is_js
npm run build
npm test

is.js's People

Contributors

takagotch avatar

Watchers

James Cloos 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.