How to use the startsWith function from underscore.string

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

123
124
125
126
127
128
129
130
131
132
133
//       throw Error("No sentiment corpus loaded");
//     }


//   id = _str.pad(id.toString(), 8, "0");
//   if (! (_str.startsWith(id, "n-") &&
//          _str.startsWith(id, "v-") &&
//          _str.startsWith(id, "a-") &&
//          _str.startsWith(id, "r-"))) {
//     switch (pos) {
//       case NOUN:
fork icon7
star icon36
watch icon4

+ 5 other calls in file

976
977
978
979
980
981
982
983
984
985
 * @return {Boolean} if symbol language or not
 * @api public
 */
function isSymbolBasedLanguage() {
    var locale = Alloy.CFG.ocapi.default_locale;
    if (_s.startsWith(locale, 'ja') || _s.startsWith(locale, 'zh')) {
        return true;
    } else {
        return false;
    }
fork icon4
star icon0
watch icon0

162
163
164
165
166
167
168
169
170
171
  console.log(files[i] + ':', png);
}
function findExact(name, filename, width, height) {
  return _.find(graphics, function(g) {
    console.log('G:' + g);
    return _s.startsWith(g.filename, name) &&
      (!filename || g.filename === filename) &&
      (!width || g.width === width) &&
      (!height || g.height === height);
  });
fork icon1
star icon4
watch icon0

77
78
79
80
81
82
83
84
85
86
87
    var modules = load_modules( path.join( __dirname, 'completors' ));
    return _u.object( _u.map( modules, function(c) { return [c.name, c] } ));
}


module.exports.completes = function( prefix, ls ) {
    var words = _u.filter( ls, function(s) {return _s.startsWith(s, prefix)} );
    var len = prefix.length;
    var partials = 
            _u.map( words, function(w) { return _s.splice(w, 0, len) } );
    return { words:words, partials:partials };
fork icon0
star icon2
watch icon2

171
172
173
174
175
176
177
178
179
180
            }
        });
    });
    return types;
}).flatten().reject(item => {
    return _s.startsWith(item, '@');
})
    .map(item => {
    if (_s.contains(item, '#')) {
        return _s.strLeftBack(item, '#') + '#';
fork icon0
star icon1
watch icon0

+ 5 other calls in file

58
59
60
61
62
63
64
65
66
67
if (headersLines.length === 0) {
  throw new InvalidRequestError('No headers');
}

var cookieIndex = _.findIndex(headersLines, function (line) {
  return _s.startsWith(line, 'Cookie:');
});
var cookieLine;
if (cookieIndex !== -1) {
  cookieLine = headersLines[cookieIndex];
fork icon1
star icon0
watch icon0

+ 3 other calls in file