インスタントカレー
6634 ワード
今日はMethoと一緒に料理をするcurry .
成分 1 x 1 x 1 x あなたの選択の1つのx機能 JS知識のピンチ
方法 追加する
「カレー」ソースを作るには
おいしい組合せのためにあなたの選ばれた機能にソースを加えてください!
代替法
主な成分はまた、ご利用いただけます中古ミックス
以上です.
あなたがこのレシピが好きであるか、それを改善する方法についてのどんな考えも持っているならば、ここで、または、Metho Cookery学校で私に線を降ろしてください.
jonrandy / metho
新しい方法
jonrandy / metho-function
機能プロトタイプ拡張
成分
metho
- あなたのローカルNPMで利用できるFunction
プロトタイプcurry
関数(一般的です.方法
metho
ボウルに:import * as Metho from "metho"
curry
関数とFunction
Methooを結合するプロトタイプです.const target = Function.prototype
function curry(func) {
return function curried(...args) {
if (args.length >= func.length) {
return func.apply(this, args)
} else {
return function(...args2) {
return curried.apply(this, args.concat(args2))
}
}
}
}
const curried = Metho.add(
target,
function() {
return curry(this)
}
)
function myAdd(a, b) {
return a + b
}
// without 'curried' sauce - kinda bland
console.log(myAdd(2, 3)) // 5
// with sauce - tasty!
const add2 = myAdd[curried](2)
console.log(add2(3)) // 5
// versatile! map it with an array
console.log([2, 4, 6].map(myAdd[curried](11))) // [13, 15, 17]
代替法
主な成分はまた、ご利用いただけます中古ミックス
metho-function
- また、すべての良いNPMで利用できます.単にインポートcurried
パケットから直接ソースを作り、前に続けます.import { curried } from 'metho-function'
...
以上です.
あなたがこのレシピが好きであるか、それを改善する方法についてのどんな考えも持っているならば、ここで、または、Metho Cookery学校で私に線を降ろしてください.
jonrandy / metho
新しい方法
jonrandy / metho-function
機能プロトタイプ拡張
Reference
この問題について(インスタントカレー), 我々は、より多くの情報をここで見つけました https://dev.to/jonrandy/instant-metho-curry-15p4テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol