Lodash - 函式



Lodash 有許多易於使用的方法,有助於建立和處理函式。本章將詳細討論這些方法。

Lodash 提供各種方法來處理函式,如下所示:

序號 方法和語法
1

ary

_.ary(func, [n=func.length])

2

before

_.before(n, func)

3

bind

_.bind(func, thisArg, [partials])

4

bindKey

_.bindKey(object, key, [partials])

5

curry

_.curry(func, [arity=func.length])

6

curryRight

_.curryRight(func, [arity=func.length])

7

delay

_.delay(func, wait, [args])

8

flip

_.flip(func)

9

memoize

_.memoize(func, [resolver])

10

negate

_.negate(predicate)

11

once

_.once(func)

12

overArgs

_.overArgs(func, [transforms=[_.identity]])

13

partial

_.partial(func, [partials])

14

partialRight

_.partialRight(func, [partials])

15

rearg

_.rearg(func, indexes)

16

rest

_.rest(func, [start=func.length-1])

17

spread

_.spread(func, [start=0])

18

unary

_.unary(func)

19

wrap

_.wrap(value, [wrapper=identity])

廣告
© . All rights reserved.