Skip to content

Commit 196695e

Browse files
author
poxi007
committed
增加FP的例子
1 parent 85f075b commit 196695e

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
/node_modules
1+
node_modules
22
/lib
33
/build

basicSyntaxSample/ramda.js

+16-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @Author: Ping Qixing
33
* @Date: 2017-07-03 08:44:15
44
* @Last Modified by: Ping Qixing
5-
* @Last Modified time: 2017-07-05 16:49:06
5+
* @Last Modified time: 2017-07-08 10:39:11
66
* @Description
77
*/
88
import R from 'ramda';
@@ -194,3 +194,18 @@ let sanitizeNames = R.compose(R.map(_underscore), R.map(R.toLower));
194194
let sortByHorsepower = R.sortBy(R.prop('horsepower'));
195195
let fasterCar = R.compose(R.last, sortByHorsepower);
196196
console.log(`${fasterCar(CARS).name} is the fastest`);
197+
198+
const secret = function (msg) {
199+
return function (r) {
200+
return console.log(msg + ' ' + r);
201+
}
202+
}
203+
204+
const mySecret = secret('hi');
205+
mySecret('there');
206+
207+
const secret2 = R.curry((msg, _) => {
208+
console.log(msg);
209+
});
210+
const mySecret2 = secret2('You!', R._);
211+
console.log(mySecret2());

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
"react": "^15.6.1",
3333
"react-addons": "^0.9.1-deprecated",
3434
"webpack": "^3.0.0",
35-
"webpack-dev-server": "^2.5.0"
35+
"webpack-dev-server": "^2.5.0",
36+
"babel-plugin-transform-es2015-modules-amd": "^6.24.1"
3637
},
3738
"dependencies": {
3839
"babel-cli": "^6.24.1",

0 commit comments

Comments
 (0)