How to use the strLeftBack function from underscore.string

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

285
286
287
288
289
290
291
292
293
294
}

var bundle = {};

bundle.js = _string.strRightBack(moduleToBundle, '/'); // The short name of the javascript file (with extension but without path)
bundle.module = _string.strLeftBack(bundle.js, '.js'); // The short name with the .js extension removed
bundle.bundleDependencyModule = (moduleToBundle === bundle.module); // The specified module to bundle is the name of a module dependency.

if (!as) {
    bundle.as = bundle.module;
fork icon18
star icon8
watch icon0

+ 8 other calls in file

73
74
75
76
77
78
79
80
81
82
83
// Put request logs after Compute Engine routes to filter out cruft
app.use(function* (next) {
    var start = new Date();


    var tags = [];
    var cleanMethod = _s.strLeftBack(this.url, '?');
    cleanMethod = _s.replaceAll(cleanMethod, '/', '_');
    cleanMethod = _s.trim(cleanMethod, '_');
    cleanMethod = this.method + '.' + cleanMethod;
    cleanMethod = cleanMethod.toLowerCase();
fork icon0
star icon7
watch icon0

+ 2 other calls in file

43
44
45
46
47
48
49
50
51
52
53
}


const _s = require('underscore.string')
no.static = (route, directory) => {
	if(!route) route = '/'
	if(!directory) directory =  _s.strLeftBack( require.main.filename, '/' )
	//TODO: start express app if not already started.
	no.expressApp.use(route, express.static(directory))
}

fork icon1
star icon2
watch icon0

+ 11 other calls in file

160
161
162
163
164
165
166
167
168
169
    //Find last variable
    var lastVar = '?' + _s.strRightBack(path, '?');
    //remove things after space if any
    if (_s.contains(lastVar, ' ')) {
        vars.push(_s.strLeftBack(lastVar, ' '));
        return _s.strLeftBack(path, ' ');
    }
    vars.push(lastVar);
    return path;
}).value();
fork icon1
star icon1
watch icon0

+ 14 other calls in file

175
176
177
178
179
180
181
182
183
184
}).flatten().reject(item => {
    return _s.startsWith(item, '@');
})
    .map(item => {
    if (_s.contains(item, '#')) {
        return _s.strLeftBack(item, '#') + '#';
    }
    else if (_s.contains(item, '/')) {
        return _s.strLeftBack(item, '/') + '/';
    }
fork icon0
star icon1
watch icon0

+ 11 other calls in file

216
217
218
219
220
221
222
223
224
225
    });
}
listSubscribers(req) {
    const db = req.params.db;
    var propertyURI = `${protocol}://${host}${req.originalUrl.split('?')[0]}`;
    propertyURI = _s.strLeftBack(propertyURI, '/subscribers');
    var getFoIs = req.query.getFoIs == 'true' ? true : false;
    var accept = req.headers.accept != '*/*' ? req.headers.accept : 'application/ld+json';
    var input = { propertyURI: propertyURI };
    if (accept == 'application/json') {
fork icon0
star icon1
watch icon0

+ 2 other calls in file

17
18
19
20
21
22
23
24
25
26
27
28
  </style>
`)


let deployId = _s.strRight(window.location.pathname, 'deploy/')
log(deployId)
deployId = _s.strLeftBack(deployId, '/log')
log(deployId)


$.post(`/deploy/${deployId}`, deploy => {
  const deployUrl = `/deploy/${deploy._id}`
fork icon2
star icon0
watch icon0

64
65
66
67
68
69
70
71
72
73
  async.series({
    'atlas': function (ccb) {
      renameAndreplaceFile(relatedFile, imgPath, f.path, destPath, opt, ccb);
    },
    'json': function (ccb) {
      var jsonFile = s.strLeftBack(relatedFile, '.') + '.json';
      renameAndreplaceFile(jsonFile, imgPath, f.path, destPath, opt, ccb);
    }
  }, callback)
} else {
fork icon0
star icon0
watch icon0

103
104
105
106
107
108
109
110
111
112
function main() {
  var files = glob.sync(['resources.assets', 'sharedassets*.assets', 'sharedassets*.assets.split0']);
  // console.log(files);
  files.forEach(function(file) {
    disunity(file, function(err, stdout) {
    var dir = _s.strLeftBack(file, '.');
    if (fs.existsSync(dir)) {
      files2png(dir);
    }
    // });
fork icon0
star icon0
watch icon0