made with esnextbin
Last active
October 8, 2016 15:58
-
-
Save aledoroshenko/b8844c3bf3d39d75b2412b3d97beca2e to your computer and use it in GitHub Desktop.
esnextbin sketch
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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>ESNextbin Sketch</title> | |
<!-- put additional styles and scripts here --> | |
</head> | |
<body> | |
<!-- put markup and other contents here --> | |
</body> | |
</html> |
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
import path from 'path'; | |
import expect from 'expect'; | |
import _ from 'lodash/fp'; | |
const isTxtFilename = _.flow(path.extname, _.isEqual('.txt')); | |
const filenames = ['image.jpg', 'test1.txt', 'test2.txt', 'java.doc']; | |
const getTxtFilenames = _.filter(isTxtFilename); | |
console.log('fired') | |
console.log('fired ', getTxtFilenames(filenames)); | |
expect(getTxtFilenames(filenames)).toEqual(['test1.txt', 'test2.txt']); |
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
{ | |
"name": "esnextbin-sketch", | |
"version": "0.0.0", | |
"dependencies": { | |
"expect": "1.20.2", | |
"undefined": "v4.5.0", | |
"lodash": "4.16.4" | |
} | |
} |
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
'use strict'; | |
var _path = require('path'); | |
var _path2 = _interopRequireDefault(_path); | |
var _expect = require('expect'); | |
var _expect2 = _interopRequireDefault(_expect); | |
var _fp = require('lodash/fp'); | |
var _fp2 = _interopRequireDefault(_fp); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | |
var isTxtFilename = _fp2.default.flow(_path2.default.extname, _fp2.default.isEqual('.txt')); | |
var filenames = ['image.jpg', 'test1.txt', 'test2.txt', 'java.doc']; | |
var getTxtFilenames = _fp2.default.filter(isTxtFilename); | |
console.log('fired'); | |
console.log('fired ', getTxtFilenames(filenames)); | |
(0, _expect2.default)(getTxtFilenames(filenames)).toEqual(['test1.txt', 'test2.txt']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment