How to use the toSentence function from underscore.string

Find comprehensive JavaScript underscore.string.toSentence code examples handpicked from public code repositorys.

41
42
43
44
45
46
47
48
49
50
var mappings = require('./config.json').reliabilityMappings;
// Derived can not be set as it is only inferred for derived properties
var options = _.filter(mappings, function (obj) { return (obj.key != 'derived'); });
// Return error if 
if (!_.chain(options).filter(function (obj) { return (obj.key == reliability); }).first().value()) {
    var err = "Unknown restriction. Use either " + _s.toSentence(_.map(options, function (o) { return o.key; }), ', ', ' or ');
    return new Error(err);
}
// Map and return class
return _.chain(options).filter(function (obj) { return (obj.key == reliability); }).map(function (obj) { return obj["class"]; }).first().value();
fork icon1
star icon1
watch icon2

+ 14 other calls in file

27
28
29
30
31
32
33
34
35
36
var args = { typeURI: typeURI };
args.queryType = (accept == 'application/json') ? 'select' : 'construct';
if (restriction) {
    var options = this.restrictions;
    if (options.indexOf(restriction) == -1) {
        this.errorHandler("Error: Unknown restriction. Use either " + _s.toSentence(options, ', ', ' or '), 400);
    }
    ;
    args.restriction = restriction;
}
fork icon0
star icon1
watch icon0

+ 2 other calls in file