0
我有一个简单的lodash混入:使用自定义功能扩展should.js
var _ = require('lodash')
_.mixin(require('lodash-uuid'))
,我可以在代码中使用像这样:
if (_.isUuid(someValue)) {
// it's a uuid!
}
我希望能够延长should.js基于测试,以利用该模块,例如:
response.should.have.property('uuid').which.is.a.uuid()
的docs用于延伸应该稍微轻一点;我想:
var uuid = should.extend('uuid', _.isUuid)
但抛出:
TypeError: response.should.have.property(...).which.is.a.uuid is not a function
不错!谢谢。 Should.js文件没有留下任何迹象表明,这将是做到这一点的方法...... – brandonscript
是的,可能。我会尽力在稍后解决。 –