f.dispatch( function(s) { return !f.existy(s) ? 'undefined' : undefined }, function(s) { return _.isString(s) ? (s.length > 1024 ? s.substring(0, 1024) + '...' : s) : undefined}, function(s) { return _.isArray(s) ? stringifyArray(s) : undefined }, function(s) { return _.isObject(s) ? JSON.stringify(s) : undefined }, function(s) { return s.toString() })
//PUT to /api/<objects>/:id $scope.language.$update(function () { var destLanguage = _.find($scope.$root.languages, function (language) { return language.objectId == $scope.language.objectId; }); if (_.isObject(destLanguage)) { _.extend(destLanguage, $scope.language); } //$alert(content, title, alertType, placement) $alert('saved', '', 'success'); //$state.go('languages.list'); });
/** * get a value by the given key * @param key * @param subKey * @returns {*} */ get(key, subKey = false) { if (dates.includes(key)) return moment(this.data[key]); if (objectsWithDefaults.includes(key) && _.isObject(this.data[key])) return subKey && this.data[key][subKey] ? this.data[key][subKey] : defaults[key]; return this.data[key]; }
function setLocalDescription(self, sdp) { var peer = getPeer(self); if (!_.isObject(sdp)) { return emitError(self, 'invalid LocalDescription'); } peer.setLocalDescription(sdp, function() { if (peer.signalingState == 'have-local-offer') { writeToSocket(self, 'offer', sdp); } else { writeToSocket(self, 'answer', sdp); } }, function(error) { emitError(self, error); }); }
test("isObject", function() { ok(_.isObject(arguments), 'the arguments object is object'); ok(_.isObject([1, 2, 3]), 'and arrays'); ok(_.isObject($('html')[0]), 'and DOM element'); ok(_.isObject(iElement), 'even from another frame'); ok(_.isObject(function () {}), 'and functions'); ok(_.isObject(iFunction), 'even from another frame'); ok(!_.isObject(null), 'but not null'); ok(!_.isObject(undefined), 'and not undefined'); ok(!_.isObject('string'), 'and not string'); ok(!_.isObject(12), 'and not number'); ok(!_.isObject(true), 'and not boolean'); ok(_.isObject(new String('string')), 'but new String()'); });
/** getGoogleUrl * @description Sync function get joined url * * @param {String} url * @return {String} */ getGoogleUrl(url, options) { let urls = 'https://images1-focus-opensocial.googleusercontent.com/gadgets/proxy' + '?container=focus' + '&url=' + url ; if (_.isObject(options)) { if (!_.isNull(options.width)) urls += `&resize_w=${options.width}`; if (!_.isNull(options.refresh)) urls += `&refresh=${options.refresh}`; } return urls; }
function graftPLIST (doc, xml, selector) { const obj = plist.parse(`<plist>${xml}</plist>`); const node = doc[selector]; if (node && Array.isArray(node) && Array.isArray(obj)) { const isNew = item => !node.some(nodeChild => nodeEqual(item, nodeChild)); doc[selector] = node.concat(obj.filter(isNew)); } else { // plist uses objects for <dict>. If we have two dicts we merge them instead of // overriding the old one. See CB-6472 const isDict = o => _.isObject(o) && !_.isDate(o); // arrays checked above if (isDict(node) && isDict(obj)) _.extend(obj, node); doc[selector] = obj; } return true; }
/* Abstract concat ======================================================================== */ _.withTest (['stdlib', 'concat2'], function () { $assert (_.concat ([1,2], [3], [4,5]), [1,2,3,4,5]) $assert (_.concat ( { foo: 1 }, { bar: 2 }), { foo: 1, bar: 2 }) $assert (_.concat ([{ foo: 1 }, { bar: 2 }]), { foo: 1, bar: 2 }) $assert (_.concat (1,2,3), 6) }, function () { _.concat = function (a, b) { var first, rest if (arguments.length === 1) { first = a[0]; rest = a.slice (1) } else { first = a; rest = [].slice.call (arguments, 1) } return _.isArrayLike (first) ? first.concat.apply (first, rest) : _.reduce2 (first, rest, function ( a, b) { if (_.isObject ( a) && _.isObject ( b)) { return _.extend ({}, a, b) } else { return a + b } }) } })
function emitError(self, name, message) { var error = null; if (_.isString(name)) { error = new Error(); if (message) { error.message = message; } error.name = name; } else if (name instanceof Error) { error = name; } if (_.isObject(error)) { if (native_emitter.listenerCount(self, 'error')) { return self.emit('error', error); } throw error; } }
this.execute(function(err, result) { if (err) { result = null; } else if (result) { if (!nm_.isObject(result)) { throw new lErrors.Query.UnexpectedType('Result type should be an object.'); } else if (!nm_.isArray(result.rows)) { throw new lErrors.Query.UnexpectedType('Result.rows type should be an array.'); } else { result = nm_.map(result.rows, function(row, index) { return self._model._newFromQueryRow(row); }); } } callback(err, result); });
return (x instanceof Set) ? new Set (x) : ((x instanceof Date) ? x : (!_.isObject (x) ? x : (_.isArray (x) ? x.slice () : _.extend ({}, x)))) },
throw new Error('invalid-prop', 'The generated plugin must contain a name property'); if(!_.isObject(plugin.plugin)) throw new Error('invalid-prop', 'The generated plugin must contain a plugin property');
function normalizeAddresses(args) { var normalizer = f.dispatch( function(xs) { return _.isArray(xs) ? xs : undefined }, function(x) { return _.isObject(x) ? [x] : undefined }, function(x) { if (f.existy(x)) throw new Error('Unknown server addresses: ' + x); return [{port: 11222, host: '127.0.0.1'}] }); return normalizer(args); }
this.execute(function(err, result) { if (err) { result = null; } else if (result) { if (!nm_.isObject(result)) { throw new lErrors.Query.UnexpectedType('Result type should be an object.'); } else if (!nm_.isArray(result.rows)) { throw new lErrors.Query.UnexpectedType('Result.rows type should be an array.'); } else if (result.rows.length > 0 ){ result = self._model._newFromQueryRow(result.rows[0]); } else { result = null; } } callback(err, result); });