You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var isxiao = s => s === "xiao"
var prop = (p, obj) => obj[p];
var propRole = R.curry(prop)("name")
var getresult = R.filter(R.pipe(propRole, isxiao))
var datas=[
{"name":"xiao","age":18},
{"name":"xiao","age":18},
{"namewww":"xi","age":18},
{"name":"mi","age":18}
]
var str = 'Lorem ipsum dolor sit amet consectetur adipiscing elit';
var getsplit = s=> s.split(" ")
var getLength = w=> w.length
var getlengarr = arr => R.map(getLength, arr)
var maxnum = arrs => R.apply(Math.max, arrs)
getresult = R.pipe(
getsplit,
getlengarr,
maxnum
)
var getresult2 = R.pipe(
R.split(' '),
R.map(R.length),
R.reduce(R.max, 0)
)
var data = {
result:"sucess",
name:"xiaomi",
age:5,
tasks:[
{"id":1,"age":18,"username":"job","newdate":"2017-01-01","is":"yes"},
{"id":1,"age":18,"username":"job","newdate":"2017-08-01","is":"no"},
{"id":1,"age":18,"username":"jobs","newdate":"2017-02-01","is":"no"},
{"id":1,"age":18,"username":"jobs","newdate":"2017-09-01","is":"yes"},
{"id":1,"age":18,"username":"jobs","newdate":"2017-03-01","is":"yes"},
{"id":1,"age":18,"username":"jobs","newdate":"2017-01-01","is":"yes"},
{"id":1,"age":18,"username":"jobs","newdate":"2017-11-01","is":"yes"},
{"id":1,"age":18,"username":"job","newdate":"2017-03-01","is":"yes"}
]
}
//提取tasks属性
var onetasks = R.prop("tasks")
//过滤出指定的用户
var filterMember = member => R.filter(
R.propEq('username', member)
);
//在去过滤掉 is都是no的 剩下都是yes的
var rejectarr = nober => R.reject(
R.propEq("is",nober)
)
// 在去按照日期来排序
var sortdate = R.sortBy(R.prop('newdate'))
var lastresult = R.pipe(
onetasks,
filterMember("jobs"),
rejectarr("no"),
sortdate
)
console.log("AAAAAAAAAAAAAAA", data)
console.log("BBBBBBBBBBB", lastresult(data))
</script>
The text was updated successfully, but these errors were encountered:
var isxiao = s => s === "xiao"
var prop = (p, obj) => obj[p];
var propRole = R.curry(prop)("name")
var getresult = R.filter(R.pipe(propRole, isxiao))
var datas=[
{"name":"xiao","age":18},
{"name":"xiao","age":18},
{"namewww":"xi","age":18},
{"name":"mi","age":18}
]
var str = 'Lorem ipsum dolor sit amet consectetur adipiscing elit';
var getsplit = s=> s.split(" ")
var getLength = w=> w.length
var getlengarr = arr => R.map(getLength, arr)
var maxnum = arrs => R.apply(Math.max, arrs)
getresult = R.pipe(
getsplit,
getlengarr,
maxnum
)
var getresult2 = R.pipe(
R.split(' '),
R.map(R.length),
R.reduce(R.max, 0)
)
var data = {
result:"sucess",
name:"xiaomi",
age:5,
tasks:[
{"id":1,"age":18,"username":"job","newdate":"2017-01-01","is":"yes"},
{"id":1,"age":18,"username":"job","newdate":"2017-08-01","is":"no"},
{"id":1,"age":18,"username":"jobs","newdate":"2017-02-01","is":"no"},
{"id":1,"age":18,"username":"jobs","newdate":"2017-09-01","is":"yes"},
{"id":1,"age":18,"username":"jobs","newdate":"2017-03-01","is":"yes"},
{"id":1,"age":18,"username":"jobs","newdate":"2017-01-01","is":"yes"},
{"id":1,"age":18,"username":"jobs","newdate":"2017-11-01","is":"yes"},
{"id":1,"age":18,"username":"job","newdate":"2017-03-01","is":"yes"}
]
}
//提取tasks属性
var onetasks = R.prop("tasks")
//过滤出指定的用户
var filterMember = member => R.filter(
R.propEq('username', member)
);
//在去过滤掉 is都是no的 剩下都是yes的
var rejectarr = nober => R.reject(
R.propEq("is",nober)
)
// 在去按照日期来排序
var sortdate = R.sortBy(R.prop('newdate'))
var lastresult = R.pipe(
onetasks,
filterMember("jobs"),
rejectarr("no"),
sortdate
)
console.log("AAAAAAAAAAAAAAA", data)
console.log("BBBBBBBBBBB", lastresult(data))
</script>
The text was updated successfully, but these errors were encountered: