How to use the last function from underscore

Find comprehensive JavaScript underscore.last code examples handpicked from public code repositorys.

148
149
150
151
152
153
154
155
156
157
    return [];
}

let actions = this.abilities.actions;
if (this.anyEffect('copyCard')) {
    let mostRecentEffect = _.last(
        this.effects.filter((effect) => effect.type === 'copyCard')
    );
    actions = mostRecentEffect.value.getActions(this);
}
fork icon9
star icon10
watch icon1

234
235
236
237
238
239
240
241
242
243
var entries = null;

var prefix = "| ";

var entryName = function (entry) {
  return _.last(entry);
};

var entryTime = function (entry) {
  return bucketTimes[JSON.stringify(entry)];
fork icon0
star icon7
watch icon4

+ 11 other calls in file

6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
      directionSymbol = dd === coordinate ? posSymbol : negSymbol;
  return pad(d) + '° ' + pad(m) + '\' ' + pad(s) + '" ' + directionSymbol;
};


var measure = function (latlngs) {
  var last = _.last(latlngs);
  var path = geocrunch.path(_.map(latlngs, function (latlng) {
    return [latlng.lng, latlng.lat];
  }));

fork icon0
star icon2
watch icon0

5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
},

unstack: function () {
	_checkBlockLabels();
	_variables.splice(_variables.length - 1, 1);
	_current = _.last(_variables);
},

getlabel: function (l) {
	for (var i = _variables.length - 1 ; i >= 0; --i) {
fork icon0
star icon0
watch icon1

+ 5 other calls in file

813
814
815
816
817
818
819
820
821
822
// Aliased as `unique`.
_.uniq = _.unique = function(array, isSorted, iterator) {
  var initial = iterator ? _.map(array, iterator) : array;
  var result = [];
  _.reduce(initial, function(memo, el, i) {
    if (0 == i || (isSorted === true ? _.last(memo) != el : !_.include(memo, el))) {
      memo[memo.length] = el;
      result[result.length] = array[i];
    }
    return memo;
fork icon0
star icon0
watch icon1

+ 6 other calls in file

30
31
32
33
34
35
36
37
38
39
_makeRequest(query, callback, route, security, method, attempt = 0) {
    assert(_.isUndefined(callback) || _.isFunction(callback), 'callback must be a function or undefined');
    assert(_.isObject(query), 'query must be an object');

    let queryString;
    const type = _.last(route.split('/')),
        options = {
            url: `${route.substring(0,4) === 'api' ? 'https://api.binance.com/' : 'https://api.binance.com/'}${route}`,
            timeout: this.timeout
        };
fork icon0
star icon0
watch icon1

354
355
356
357
358
359
360
361
362
363
router.get('/api/listTagData', function (req, res) {
  async.waterfall([
    function (nextCall) {
      var sqlss = " SELECT * FROM tag_amazon";
      connection.query(sqlss, function (err, rides) {
        // console.log('rides: ', _.last(rides));
        if (err) {
          return nextCall({
            "message": "something went wrong",
          });
fork icon0
star icon0
watch icon1