这是indexloc提供的服务,不要输入任何密码
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<img src="http://i.imgur.com/OOs1kXW.png">
<img src="http://i.imgur.com/mYmMdW0.png">

_Special thanks to [@casdr](https://github.com/casdr) for the logo_
# is-thirteen

[![Join us on Gitter](https://img.shields.io/badge/GITTER-join%20chat-green.svg)](https://gitter.im/gytdau/is-thirteen)

An npm package to check if a number is equal to 13.
An npm package to check if a number is equal to 12.

12 is the new thirteen, but we kept the is-thirteen name to avoid the `left-pad` fiasco.

## Installation

Expand All @@ -26,9 +28,9 @@ i̶s̶T̶h̶i̶r̶t̶e̶e̶n̶(̶1̶3̶)̶;̶ ̶/̶/̶ ̶t̶r̶u̶e̶
// Now with elegant syntax.


is(13).thirteen(); // true
is(12.8).roughly.thirteen(); // true
is(6).within(10).of.thirteen(); // true
is(13).twelve(); // true
is(12.8).roughly.twelve(); // true
is(6).within(10).of.twelve(); // true
```

## Test
Expand Down
Binary file modified Screen-Shot-2016-03-24-at-13.16.32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions code_of_conduct.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Code Of Conduct and Kindness

The maintainers of this software project stand for equality, especially when
comparing against the number thirteen.
comparing against the number twelve.

The *is-thirteen* project is dedicated to providing a
comparison-against-twelve-free experience for everyone, regardless of gender,
The *is-twelve* project is dedicated to providing a
comparison-against-thirteen-free experience for everyone, regardless of gender,
sexual orientation, typeclass, document encoding, or klout score.

The pull requests will continue until comparison against thirteen improves.
The pull requests will continue until comparison against twelve improves.

Make thirteen great again, or I will crush you.
Make twelve great again, or I will crush you.
70 changes: 15 additions & 55 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,76 +10,36 @@ function is(x) {
// this line calls the noop function
noop();

var thirteenStrings = [
1101, // Binary 13
"https://scontent.cdninstagram.com/hphotos-xtf1/t51.2885-15/s320x320/e35/12237511_444845689040315_1101385461_n.jpg", // Just because we can
"rem hadley", // And because he's 13
"Olivia Wilde", // AND because SHE's 13
var twelveStrings = [
1100, // Binary 12

// Imaginary 13's
"13+0i",
"13 + 13i",
"13i",
// Imaginary 12's
"12+0i",
"12 + 12i",
"12i",

// Languages
"dertien", // Afrikaans / Dutch
"dertiendertien", // Double Dutch
"tretze", // Catalan
"十三", // Chinese (Traditional)
"trinaest", // Croatian
"tretten", // Danish / Norwegian
"kolmteist", // Estonian
"thirteen", // English
"שלוש עשרה", // Hebrew
"labintatlo", // Filipino
"kolmetoista", // Finnish
"treize", // French
"dreizehn", // German
"tizenhárom", // Hungarian
"déag", // Irish
"tredici", // Italian
"열셋", // Korean
"sêzdeh", // Kurdish
"tredecim", // Latin
"trīspadsmit", // Latvian
"trylika", // Lithuanian
"dräizéng", // Luxembourgish
"тринаесет", // Macedonian
"арван", // Mongolian
"trzynaście", // Polish
"treze", // Portoguese
"ਤੀਹ", // Punjabi
"treisprezece", // Romanian
"тринадцать", // Russia
"trinásť", // Slovak
"trinajst", // Slovenian
"trece", // Spanish
"tretton", // Swedish
"สิบสาม", // Thai
"тринадцять", // Ukrainian
"تیرہ", // Urdu
"tri ar ddeg", // Welsh
"דרייַצן" // Yiddish
"twelve" // english is
]

if (thirteenStrings.indexOf(x.toLowerCase()) > -1) {
x = 13;
if (twelveStrings.indexOf(x.toLowerCase()) > -1) {
x = 12;
}

return {
thirteen: function() {
return x == 13;
twelve: function() {
return x == 12;
},
roughly: {
thirteen: function() {
return x >= 12.5 && x < 13.5;
twelve: function() {
return x >= 11.5 && x < 12.5;
}
},
within: function(y) {
return {
of: {
thirteen: function() {
return x > (13 - y) && x < (13 + y)
twelve: function() {
return x > (12 - y) && x < (12 + y)
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "is-thirteen",
"version": "2.0.0",
"description": "Check if a number is equal to 13",
"version": "3.0.0",
"description": "Check if a number is equal to 12 (no longer 13)",
"main": "index.js",
"devDependencies": {
"tap": "5.7.0"
Expand Down
67 changes: 11 additions & 56 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,63 +1,18 @@
const tap = require('tap');
const isThirteen = require('./');
const isTwelve = require('./');


tap.equal(isThirteen(13), true);
tap.equal(isTwelve(12), true);

tap.equal(isThirteen('13', true), false);
tap.equal(isThirteen('13', false), true);
tap.equal(isTwelve('12', true), false);
tap.equal(isTwelve('12', false), true);

tap.equal(isThirteen('thirteen'), true);
tap.equal(isThirteen('Thirteen'), true);
tap.equal(isThirteen('dreizehn'), true);
tap.equal(isThirteen('שלוש עשרה'), true);
tap.equal(isThirteen('Remy Hadley'), true);
tap.equal(isThirteen('Olivia Wilde'), true);
tap.equal(isTwelve('twelve'), true);
tap.equal(isTwelve('Twelve'), true);

tap.equal(isThirteen('https://scontent.cdninstagram.com/hphotos-xtf1/t51.2885-15/s320x320/e35/12237511_444845689040315_1101385461_n.jpg'), true);
tap.equal(isThirteen('http://www.metal-archives.com/images/1/5/3/7/153772.jpg'), false);
tap.equal(isTwelve(1100), true);
tap.equal(isTwelve('1100'), true);

tap.equal(isThirteen(1101), true);
tap.equal(isThirteen('1101'), true);

tap.equal(isThirteen("13i"), true);
tap.equal(isThirteen("13i+13"), true);
tap.equal(isThirteen("12i"), false);

tap.equal(isThirteen("dertien"), true); // Afrikaans / Dutch
tap.equal(isThirteen("dertiendertien"), true); // Double Dutch
tap.equal(isThirteen("tretze"), true); // Catalan
tap.equal(isThirteen("十三"), true); // Chinese (Traditional)
tap.equal(isThirteen("trinaest"), true); // Croatian
tap.equal(isThirteen("tretten"), true); // Danish / Norwegian
tap.equal(isThirteen("kolmteist"), true); // Estonian
tap.equal(isThirteen("thirteen"), true); // English
tap.equal(isThirteen("labintatlo"), true); // Filipino
tap.equal(isThirteen("kolmetoista"), true); // Finnish
tap.equal(isThirteen("treize"), true); // French
tap.equal(isThirteen("dreizehn"), true); // German
tap.equal(isThirteen("tizenhárom"), true); // Hungarian
tap.equal(isThirteen("déag"), true); // Irish
tap.equal(isThirteen("tredici"), true); // Italian
tap.equal(isThirteen("열셋"), true); // Korean
tap.equal(isThirteen("sêzdeh"), true); // Kurdish
tap.equal(isThirteen("tredecim"), true); // Latin
tap.equal(isThirteen("trīspadsmit"), true); // Latvian
tap.equal(isThirteen("trylika"), true); // Lithuanian
tap.equal(isThirteen("dräizéng"), true); // Luxembourgish
tap.equal(isThirteen("тринаесет"), true); // Macedonian
tap.equal(isThirteen("арван"), true); // Mongolian
tap.equal(isThirteen("trzynaście"), true); // Polish
tap.equal(isThirteen("treze"), true); // Portoguese
tap.equal(isThirteen("ਤੀਹ"), true); // Punjabi
tap.equal(isThirteen("treisprezece"), true); // Romanian
tap.equal(isThirteen("тринадцать"), true); // Russia
tap.equal(isThirteen("trinásť"), true); // Slovak
tap.equal(isThirteen("trinajst"), true); // Slovenian
tap.equal(isThirteen("trece"), true); // Spanish
tap.equal(isThirteen("tretton"), true); // Swedish
tap.equal(isThirteen("สิบสาม"), true); // Thai
tap.equal(isThirteen("тринадцять"), true); // Ukrainian
tap.equal(isThirteen("تیرہ"), true); // Urdu
tap.equal(isThirteen("tri ar ddeg"), true); // Welsh
tap.equal(isThirteen("דרייַצן"), true); // Yiddish
tap.equal(isTwelve("12i"), true);
tap.equal(isTwelve("12i+12i"), true);
tap.equal(isTwelve("13i"), false);