本文整理汇总了TypeScript中lodash.isUndefined函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isUndefined函数的具体用法?TypeScript isUndefined怎么用?TypeScript isUndefined使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isUndefined函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: Promise
var savePromise = new Promise(function (resolve, reject) {
var nodeId = _.isUndefined(params.id) ? params.parent_id : params.id;
nestSet.getNodeInfo(nodeId).then(function (result) {
if (_.isEmpty(result)) {
reject();
} else {
resolve(helper.getFirstItemArray(result));
}
}).catch(function (err) {
reject();
});
});
示例2: function
User.prototype.getUser = function (select, where, first) {
if (_.isUndefined(first)) first = false;
return new Promise(function (resolve, reject) {
var sql = helper.buildQuery.select(select).from('apt_user').where(where).render();
connection.query(sql, function (err, rows) {
if (err) { reject(err); }
else {
resolve((first) ? helper.getFirstItemArray(rows) : rows);
}
});
});
};
示例3: convertXAxisRotateName
/**
* x축 가로/세로에 따라 축명 위치변경
* @param chartOption
* @param uiOption
* @param axisType
*/
public static convertXAxisRotateName(chartOption: BaseOption, uiOption: UIOption, fieldInfo: PivotTableInfo): BaseOption {
// type이 없는경우 return
if (!uiOption || _.isUndefined(uiOption['align'])) return chartOption;
const axisList = _.compact(_.concat(uiOption.xAxis, uiOption.yAxis, uiOption.subAxis));
const type = uiOption['align'];
const yAxis = axisList.filter((item) => {
return _.eq(item.mode, AxisLabelType.COLUMN) || _.eq(item.mode, AxisLabelType.SUBCOLUMN);
});
// 앞에서 category / value위치를 변경하였으므로 변경된 type에 따라서 위치변경
let copiedOption = _.cloneDeep(chartOption);
let yAxisType: AxisType;
// default일때(세로모드, x축 category, y축 value)에는 변경하지않음
if (_.eq(type, UIOrient.VERTICAL) && copiedOption.yAxis[0].type == AxisType.VALUE && copiedOption.xAxis[0].type == AxisType.CATEGORY) return chartOption;
// 세로모드일때
if (_.eq(type, UIOrient.VERTICAL)) {
// y축이 value이면 => y축 값을 x축으로 넣기
yAxisType = AxisType.VALUE;
// 가로모드일때
} else {
// y축이 category이면 => y축 값을 x축으로 넣기
yAxisType = AxisType.CATEGORY;
}
// Y축 명칭
const yName = uiOption.yAxis.customName ? uiOption.yAxis.customName : _.join(fieldInfo.aggs, CHART_STRING_DELIMITER);
const yAxisName = _.join(fieldInfo.aggs, CHART_STRING_DELIMITER);
// y축이 yAxisType이면 => y축 값을 x축으로 넣기
copiedOption.yAxis.forEach((axis, axisIndex) => {
chartOption.xAxis.forEach((item, index) => {
if (axis.type == yAxisType && copiedOption.yAxis[index].axisName) {
item.axisName = yAxisName;
// customName이 없을때
if (!yAxis[axisIndex].customName && copiedOption.yAxis[index].name) {
item.name = yName;
}
}
});
})
return chartOption;
}
示例4: observableUnwrap
observableUnwrap(e: any) {
if(e.flash) {
this.doFlash(e.flash);
return e.data;
}
if(!_.isUndefined(e.data)) {
return e.data;
}
return e;
}
示例5: getOrdersAsync
/**
* Retrieve orders from the API
* @param requestOpts Options specifying orders to retrieve and page information, defaults to { page: 1, perPage: 100 }
* @return The resulting SignedOrders that match the request
*/
public async getOrdersAsync(requestOpts?: OrdersRequestOpts & PagedRequestOpts): Promise<SignedOrder[]> {
if (!_.isUndefined(requestOpts)) {
assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.ordersRequestOptsSchema);
assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.pagedRequestOptsSchema);
}
const httpRequestOpts = {
params: _.defaults({}, requestOpts, DEFAULT_PAGED_REQUEST_OPTS),
};
const responseJson = await this._requestAsync(`/orders`, HttpRequestType.Get, httpRequestOpts);
const orders = relayerResponseJsonParsers.parseOrdersJson(responseJson);
return orders;
}
示例6:
onOrderStateChangeCallback: (err: Error | null, orderState?: OrderState) => {
if (!_.isUndefined(err)) {
utils.log(err);
} else {
const state = orderState as OrderState;
if (!state.isValid) {
shadowedOrders.set(state.orderHash, Date.now());
} else {
shadowedOrders.delete(state.orderHash);
}
}
},
示例7: _getTokenRegistryContractAsync
private async _getTokenRegistryContractAsync(): Promise<TokenRegistryContract> {
if (!_.isUndefined(this._tokenRegistryContractIfExists)) {
return this._tokenRegistryContractIfExists;
}
const [abi, address] = await this._getContractAbiAndAddressFromArtifactsAsync(
artifacts.TokenRegistryArtifact,
this._contractAddressIfExists,
);
const contractInstance = new TokenRegistryContract(this._web3Wrapper, abi, address);
this._tokenRegistryContractIfExists = contractInstance;
return this._tokenRegistryContractIfExists;
}
示例8: getTokenPairsAsync
/**
* Retrieve token pair info from the API
* @param requestOpts Options specifying token information to retrieve and page information, defaults to { page: 1, perPage: 100 }
* @return The resulting TokenPairsItems that match the request
*/
public async getTokenPairsAsync(requestOpts?: TokenPairsRequestOpts & PagedRequestOpts): Promise<TokenPairsItem[]> {
if (!_.isUndefined(requestOpts)) {
assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.tokenPairsRequestOptsSchema);
assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.pagedRequestOptsSchema);
}
const httpRequestOpts = {
params: _.defaults({}, requestOpts, DEFAULT_PAGED_REQUEST_OPTS),
};
const responseJson = await this._requestAsync('/token_pairs', HttpRequestType.Get, httpRequestOpts);
const tokenPairs = relayerResponseJsonParsers.parseTokenPairsJson(responseJson);
return tokenPairs;
}
示例9: getLocationByOffset
export const collectCoverageEntries = (contractSource: string) => {
const sourceHash = ethUtil.sha3(contractSource).toString('hex');
if (_.isUndefined(coverageEntriesBySourceHash[sourceHash])) {
const ast = parser.parse(contractSource, { range: true });
const locationByOffset = getLocationByOffset(contractSource);
const visitor = new ASTVisitor(locationByOffset);
parser.visit(ast, visitor);
coverageEntriesBySourceHash[sourceHash] = visitor.getCollectedCoverageEntries();
}
const coverageEntriesDescription = coverageEntriesBySourceHash[sourceHash];
return coverageEntriesDescription;
};
示例10: createMetricLabel
createMetricLabel(labelData, options) {
let label = '';
if (_.isUndefined(options) || _.isEmpty(options.legendFormat)) {
label = this.getOriginalMetricName(labelData);
} else {
label = this.renderTemplate(this.templateSrv.replace(options.legendFormat), labelData);
}
if (!label || label === '{}') {
label = options.query;
}
return label;
}