哪个相当于lodash中的下划线js _.unique和_.pluck?
Which is the equivalent of underscore js _.unique and _.pluck in lodash?
我的代码是:
var product_list = _.unique(_.pluck(data, 'Product'))
var facility_list = _.unique(_.pluck(data, 'Facility'))
我上面用到了underscore js。现在我需要使用 Lodash js 完成相同的功能。我应该使用哪一个?请帮忙。
使用_.map
代替_.pluck
,使用_.uniq
代替_.unique
。
var product_list = _.uniq(_.map(data, 'Product'))
var facility_list = _.uniq(_.map(data, 'Facility'))
我的代码是:
var product_list = _.unique(_.pluck(data, 'Product'))
var facility_list = _.unique(_.pluck(data, 'Facility'))
我上面用到了underscore js。现在我需要使用 Lodash js 完成相同的功能。我应该使用哪一个?请帮忙。
使用_.map
代替_.pluck
,使用_.uniq
代替_.unique
。
var product_list = _.uniq(_.map(data, 'Product'))
var facility_list = _.uniq(_.map(data, 'Facility'))