How to use the isObject function from underscore

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

979
980
981
982
983
984
985
986
987
988
else if( opts.pageSize ) {
    currentPage = req.getman.uint("page") || 0;
    listOpts.query = (listOpts.query || crud.selectListQuery.sql) + " LIMIT ?, ?";

    /* ensure edited object is included */
    if( _.isObject( values ) && currentPage == 0 ) {
        listOpts.query = listOpts.query.replace( /ORDER BY/, 'ORDER BY ??.??=? DESC,');
        listOpts.parameters = (listOpts.parameters || [ crud.table, crud.table, crud.key, values[crud.key], crud.orderBy])
            .concat([ currentPage * opts.pageSize, opts.pageSize ]);
    }
fork icon3
star icon9
watch icon1

+ 11 other calls in file

25
26
27
28
29
30
31
32
33
34
case 'hash':
  validator = function(value) {
    // it's tricky, exclude any object that resemble a message, which is an hash that contains messageId and chatId
    // also the has could be nested in the payload, in that case if the payload has an attribute with the same
    // name of the variable I'm searching for, skip it
    return _.isObject(value) && value.chatId == null && value.messageId == null && value[name] == null;
  };
  break;
case 'float':
  validator = validators.float;
fork icon0
star icon1
watch icon1

+ 2 other calls in file

33
34
35
36
37
38
39
40
41
if (msg.payload != null && _.isString(msg.payload.content)) {
  specials.message = msg.payload.content;
} else if (msg.previous != null && _.isString(msg.previous.content)) {
  specials.message = msg.previous.content;
}
const payload = _.isObject(msg.payload) ? msg.payload : {};
const options = Object.assign({
  preserveNumbers: false // do not translate numbers into string
}, opts)
fork icon0
star icon1
watch icon1

222
223
224
225
226
227
228
229
230
231
 * @param {Object} files
 * @return {Object}
 */
function setDefaults(files) {
    return files.map(function(f) {
        var file = _.isObject(f) ? f : {pattern: f};
        if (!file.included && !file.webpack) {
            file.included = false;
        }
        return file;
fork icon0
star icon0
watch icon1

405
406
407
408
409
410
411
412
413
414

if (!_.isString(password)) {
    throw new Error("No password given.");
}

var json = _.isObject(v3Keystore)
    ? v3Keystore
    : JSON.parse(nonStrict ? v3Keystore.toLowerCase() : v3Keystore);

if (json.version !== 3) {
fork icon0
star icon0
watch icon5

+ 3 other calls in file

13
14
15
16
17
18
19
20
21
22
23
24
25


//  自动添加type


function checkJsonSchema(json) {
  let newJson = Object.assign({}, json);
  if (_.isUndefined(json.type) && _.isObject(json.properties)) {
    newJson.type = 'object';
  }


  return newJson;
fork icon0
star icon0
watch icon1

25
26
27
28
29
30
31
32
33
34
35
    }
};


const getLookupFieldValue = async function(reference_to, value, space_id) {
    var name_field_key, previous_ids, reference_to_object, values;
    if (_.isArray(reference_to) && _.isObject(value)) {
      reference_to = value.o;
      previous_ids = value.ids;
    }
    if (!_.isArray(previous_ids)) {
fork icon0
star icon0
watch icon1

3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
fork icon0
star icon0
watch icon0

+ 21 other calls in file