mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 02:17:50 +00:00
Replace _.result use with _.get.
This commit is contained in:
@@ -83,7 +83,7 @@ function isThru(name) {
|
|||||||
*/
|
*/
|
||||||
function getTemplate(moduleName) {
|
function getTemplate(moduleName) {
|
||||||
var data = {
|
var data = {
|
||||||
'name': _.result(mapping.aliasToReal, moduleName, moduleName),
|
'name': _.get(mapping.aliasToReal, moduleName, moduleName),
|
||||||
'mapping': mapping
|
'mapping': mapping
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
var convert = require('./convert'),
|
var convert = require('./convert'),
|
||||||
func = convert('<%= name %>', require('../<%= _.result(mapping.remap, name, name) %>'));
|
func = convert('<%= name %>', require('../<%= _.get(mapping.remap, name, name) %>'));
|
||||||
|
|
||||||
func.placeholder = require('./placeholder');
|
func.placeholder = require('./placeholder');
|
||||||
module.exports = func;
|
module.exports = func;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
var convert = require('./convert'),
|
var convert = require('./convert'),
|
||||||
func = convert('<%= name %>', require('../<%= _.result(mapping.remap, name, name) %>'), require('./_falseOptions'));
|
func = convert('<%= name %>', require('../<%= _.get(mapping.remap, name, name) %>'), require('./_falseOptions'));
|
||||||
|
|
||||||
func.placeholder = require('./placeholder');
|
func.placeholder = require('./placeholder');
|
||||||
module.exports = func;
|
module.exports = func;
|
||||||
|
|||||||
@@ -294,7 +294,7 @@ function optionToArray(name, string) {
|
|||||||
function optionToValue(name, string) {
|
function optionToValue(name, string) {
|
||||||
var result = string.match(RegExp('^' + name + '(?:=([\\s\\S]+))?$'));
|
var result = string.match(RegExp('^' + name + '(?:=([\\s\\S]+))?$'));
|
||||||
if (result) {
|
if (result) {
|
||||||
result = _.result(result, 1);
|
result = _.get(result, 1);
|
||||||
result = result ? _.trim(result) : true;
|
result = result ? _.trim(result) : true;
|
||||||
}
|
}
|
||||||
if (result === 'false') {
|
if (result === 'false') {
|
||||||
@@ -366,8 +366,8 @@ function onJobStart(error, res, body) {
|
|||||||
if (this.stopping) {
|
if (this.stopping) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var statusCode = _.result(res, 'statusCode'),
|
var statusCode = _.get(res, 'statusCode'),
|
||||||
taskId = _.first(_.result(body, 'js tests'));
|
taskId = _.first(_.get(body, 'js tests'));
|
||||||
|
|
||||||
if (error || !taskId || statusCode != 200) {
|
if (error || !taskId || statusCode != 200) {
|
||||||
if (this.attempts < this.retries) {
|
if (this.attempts < this.retries) {
|
||||||
@@ -408,19 +408,19 @@ function onJobStatus(error, res, body) {
|
|||||||
if (!this.running || this.stopping) {
|
if (!this.running || this.stopping) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var completed = _.result(body, 'completed', false),
|
var completed = _.get(body, 'completed', false),
|
||||||
data = _.first(_.result(body, 'js tests')),
|
data = _.first(_.get(body, 'js tests')),
|
||||||
elapsed = (_.now() - this.timestamp) / 1000,
|
elapsed = (_.now() - this.timestamp) / 1000,
|
||||||
jobId = _.result(data, 'job_id', null),
|
jobId = _.get(data, 'job_id', null),
|
||||||
jobResult = _.result(data, 'result', null),
|
jobResult = _.get(data, 'result', null),
|
||||||
jobStatus = _.result(data, 'status', ''),
|
jobStatus = _.get(data, 'status', ''),
|
||||||
jobUrl = _.result(data, 'url', null),
|
jobUrl = _.get(data, 'url', null),
|
||||||
expired = (elapsed >= queueTimeout && !_.includes(jobStatus, 'in progress')),
|
expired = (elapsed >= queueTimeout && !_.includes(jobStatus, 'in progress')),
|
||||||
options = this.options,
|
options = this.options,
|
||||||
platform = options.platforms[0];
|
platform = options.platforms[0];
|
||||||
|
|
||||||
if (_.isObject(jobResult)) {
|
if (_.isObject(jobResult)) {
|
||||||
var message = _.result(jobResult, 'message');
|
var message = _.get(jobResult, 'message');
|
||||||
} else {
|
} else {
|
||||||
if (typeof jobResult == 'string') {
|
if (typeof jobResult == 'string') {
|
||||||
message = jobResult;
|
message = jobResult;
|
||||||
@@ -442,7 +442,7 @@ function onJobStatus(error, res, body) {
|
|||||||
}
|
}
|
||||||
var description = browserName(platform[1]) + ' ' + platform[2] + ' on ' + _.startCase(platform[0]),
|
var description = browserName(platform[1]) + ' ' + platform[2] + ' on ' + _.startCase(platform[0]),
|
||||||
errored = !jobResult || !jobResult.passed || reError.test(message) || reError.test(jobStatus),
|
errored = !jobResult || !jobResult.passed || reError.test(message) || reError.test(jobStatus),
|
||||||
failures = _.result(jobResult, 'failed'),
|
failures = _.get(jobResult, 'failed'),
|
||||||
label = options.name + ':',
|
label = options.name + ':',
|
||||||
tunnel = this.tunnel;
|
tunnel = this.tunnel;
|
||||||
|
|
||||||
|
|||||||
@@ -345,7 +345,7 @@
|
|||||||
var aryCap = index + 1;
|
var aryCap = index + 1;
|
||||||
|
|
||||||
var methodNames = _.filter(mapping.aryMethod[aryCap], function(methodName) {
|
var methodNames = _.filter(mapping.aryMethod[aryCap], function(methodName) {
|
||||||
var key = _.result(mapping.remap, methodName, methodName),
|
var key = _.get(mapping.remap, methodName, methodName),
|
||||||
arity = _[key].length;
|
arity = _[key].length;
|
||||||
|
|
||||||
return arity != 0 && arity < aryCap;
|
return arity != 0 && arity < aryCap;
|
||||||
|
|||||||
Reference in New Issue
Block a user