-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
2,783 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"presets": [ | ||
["env", { | ||
"targets": { | ||
"browsers": [ | ||
"last 2 versions", | ||
"IE >= 9" | ||
] | ||
} | ||
}] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
language: node_js | ||
node_js: | ||
- '7' | ||
before_script: | ||
- npm install | ||
script: | ||
- npm test | ||
deploy: | ||
provider: npm | ||
email: [email protected] | ||
api_key: | ||
secure: rm+EaAEFArhvOJhXPSmesp6oH2IRe4+xovWhLa9c8IH5eE3sBmwVd8JmrHRwZQqF3Z2m6EHgNFMJyWAt76UL+4oineyXc3ju+JBGzLZcVqGiAkLz48+LJqHWsenzHn+BAlAFzCYBKCbUtaYl7l68IZZ6krin74NhQkgs//w6GKxng446LncyUU4qQBVzWabR//iYqpjFYvEhPHBCSicjWYzHcm7v+6/kqZJbJxxllGbdA3U8R1wgj79S5bNNC8ylVZKNnGCFcOeg0avXMRNAvlNKRmW41IVv+1cPYh9nTkVBbeW3FYn8xo7Fv39zulDHP1YEfp9tu0N7i5ni7C4spIjHAxrTp9H4ddJ7k15tr2AQwTgIcqwtPH3Xx9Q1JU5bgRrr9shTEd5+x+Tz6Hd00Df6Os2C6huiN/renpaJa/61kowvIXNYNmUMN2M3dptl0y46SaDSlSV3jqK5yyWq/21e9R1FldbcJnRzdv3vksKE3nWp/cqXWx3vbPMeWUjfTvT9K9Le6ZhwHw7g0sReX+9rhFEkMo5ATlaaiw4dGnM7WGSZs1IRNtCYaYKrInT1rLYq0f4gBaNoRD9Ef4yzKrRg4jNFv7W4T6HC7UaNnFizWCZc8pMrD6F1VHHUVJDQBra+ZjgxQyndHQnCDze70oihhpdiEI2gXyguqaABBd8= | ||
on: | ||
tags: true | ||
repo: batata-frita/vybor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"name": "vybor", | ||
"version": "0.1.2", | ||
"description": "Function to choose. Like `switch`, but you don't need an IIFE", | ||
"main": "dist/index.js", | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
"dist": "babel src/ -d dist/", | ||
"test": "jest", | ||
"prepare": "npm test && npm run dist" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/batata-frita/vybor.git" | ||
}, | ||
"keywords": [], | ||
"constributors": [ | ||
"Kir Belevich <[email protected]> (https://github.com/deepsweet)", | ||
"Xavier Via <[email protected]> (http://github.com/xaviervia)" | ||
], | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/batata-frita/vybor/issues" | ||
}, | ||
"homepage": "https://github.com/batata-frita/vybor#readme", | ||
"devDependencies": { | ||
"babel-cli": "^6.24.1", | ||
"jest": "^20.0.4", | ||
"babel-preset-env": "^1.6.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const выбор = (...args) => { | ||
if (args.length > 0) { | ||
if (args[0] === true) { | ||
return args[1] | ||
} | ||
|
||
return выбор(...args.slice(2)) | ||
} | ||
} | ||
|
||
export default выбор |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import выбор from '../src' | ||
import {equal} from 'assert' | ||
|
||
describe('выбор', () => { | ||
it('returns the successor of the closest match', () => { | ||
equal(выбор('two')( | ||
'one', 1, | ||
'two', 2, | ||
'three', 3 | ||
), 2) | ||
}) | ||
|
||
it('returns undefined if nothing is matched', () => { | ||
equal(выбор('four')( | ||
'one', 1, | ||
'two', 2, | ||
'three', 3 | ||
), undefined) | ||
}) | ||
}) |
Oops, something went wrong.