我是否错误地使用了lodash.fp的convert
方法?似乎它在words
const fp = require('lodash/fp')
const assert = require('assert')
const words = fp.words.convert({ cap: false })
assert.equal(typeof words, 'function') // true as expected
// here I'd expect `words` to return a function that is expecting the
// remaining string argument
const splitByX = words(/[^x]+/g)
assert.equal(typeof splitByX, 'function')
在此处发布了上述代码段:https://runkit.com/lokua/lodash-fp-words-bug
我也尝试在fixed: false
的调用中使用convert
,但得到完全相同的结果。
这对我来说似乎是一个错误,但我认为最好在提交报告之前在StackOverflow上发帖,以防我了解转换工作的方式。
以下是相关问题的链接,询问fp.words的工作原理,答案是使用convert:https://github.com/lodash/lodash/issues/3397
使用lodash@4.17.4