本文整理匯總了TypeScript中underscore.extend函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript extend函數的具體用法?TypeScript extend怎麽用?TypeScript extend使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了extend函數的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: format
// Converts a map to a string space-delimited key=val pairs
function format(data) {
if (deploy_env || workflow_id || pod_id || pod_account || pod_region) {
const extras: any = {};
if (deploy_env) { extras.deploy_env = deploy_env; }
if (workflow_id) { extras.wf_id = workflow_id; }
if (pod_id) { extras["pod-id"] = pod_id; }
if (pod_region) { extras["pod-region"] = pod_region; }
if (pod_account) { extras["pod-account"] = pod_account; }
return JSON.stringify(_.extend(extras, data), replaceErrors);
}
return JSON.stringify(data, replaceErrors);
}
示例2: sendType1Message
// The following method is an adaptation of code found at https://github.com/SamDecrock/node-http-ntlm/blob/master/httpntlm.js
private sendType1Message(httpClient, protocol, options, objs, keepaliveAgent, callback): void {
var type1msg = ntlm.createType1Message(options);
var type1options = {
headers: {
'Connection': 'keep-alive',
'Authorization': type1msg
},
timeout: options.timeout || 0,
agent: keepaliveAgent,
// don't redirect because http could change to https which means we need to change the keepaliveAgent
allowRedirects: false
};
type1options = _.extend(type1options, _.omit(options, 'headers'));
httpClient.requestInternal(protocol, type1options, objs, callback);
}
示例3: function
select: function (label:string, args: any, options: OptionObj[]) : _mithril.MithrilVirtualElement {
var id = label.replace(/\s/g, '');
return [
m('label', {
for: 'id'
}, [
label,
m('select', _.extend({
name: id,
id: id
}, args), _.map(options, objToOption))
]),
];
},
示例4: fix
fix(focus: Focus) {
focus.xl = focus.xl < 0 ? 0 : focus.xl;
focus.xr = focus.xr > 1 ? 1 : focus.xr;
focus.yl = focus.yl < 0 ? 0 : focus.yl;
focus.yr = focus.yr > 1 ? 1 : focus.yr;
focus.yl_r = focus.yl_r < 0 ? 0 : focus.yl_r;
focus.yr_r = focus.yr_r > 1 ? 1 : focus.yr_r;
focus.xspan = focus.xr - focus.xl;
focus.yspan = focus.yr - focus.yl;
focus.yspan_r = focus.yr_r - focus.yl_r;
if (focus.xl > focus.xr || focus.yl > focus.yr || focus.yl_r > focus.yr_r) {
console.error("visible range specified does not match data range, " +
"enforcing visible range");
_.extend(focus, this.defaultFocus);
}
}
示例5: _internalAnalyzePacket
function _internalAnalyzePacket(buffer: Buffer, stream: BinaryStream, objMessage: any, padding: number, customOptions?: AnalyzePacketOptions, offset?: number) {
let options: any = make_tracer(buffer, padding, offset);
options.name = "message";
options = _.extend(options, customOptions);
try {
if (objMessage) {
objMessage.decodeDebug(stream, options);
} else {
console.log(" Invalid object", objMessage);
}
} catch (err) {
console.log(" Error in ", err);
console.log(" Error in ", err.stack);
console.log(" objMessage ", util.inspect(objMessage, {colors: true}));
}
}
示例6: Exec
public static async Exec(tfvc: ITfCommandLine, cwd: string, args: IArgumentProvider, options: any = {}): Promise<IExecutionResult> {
// default to the cwd passed in, but allow options.cwd to overwrite it
options = _.extend({ cwd }, options || {});
// TODO: do we want to handle proxies or not for the EXE? for tf.exe the user could simply setup the proxy at the command line.
// tf.exe remembers the proxy settings and uses them as it needs to.
if (tfvc.proxy && !tfvc.isExe) {
args.AddProxySwitch(tfvc.proxy);
}
Logger.LogDebug(`TFVC: tf ${args.GetArgumentsForDisplay()}`);
if (options.log !== false) {
TfvcOutput.AppendLine(`tf ${args.GetArgumentsForDisplay()}`);
}
return await TfCommandLineRunner.run(tfvc, args, options, tfvc.isExe);
}
示例7:
this.http.get(url).forEach(response => {
let tempState = window.history.state;
let a = response.json();
if (a.data[0] !== 'Authorized') {
this.appState.set('authenticated', true);
this.appState.set('learn', true);
this.router.navigate(['/welcome']);
window.history.replaceState(undefined, undefined, '');
} else {
this.appState.set('authenticated', true);
this.appState.set('isDisabled', false);
this.router.navigate([`/${page}`]);
tempState = _.extend(tempState, this.appState._state);
window.history.pushState(tempState, undefined, page);
}
}).catch(err => console.log('ERROR:', err));
示例8: function
var DataForm = function (app, options) {
this.app = app;
app.locals.formsAngular = app.locals.formsAngular || [];
app.locals.formsAngular.push(this);
this.mongoose = mongoose;
this.options = _.extend({
urlPrefix: '/api/'
}, options || {});
this.resources = [ ];
this.searchFunc = async.forEach;
this.registerRoutes();
this.app.get.apply(this.app, processArgs(this.options, ['search', this.searchAll()]));
if (this.options.JQMongoFileUploader) {
var JqUploadModule = this.options.JQMongoFileUploader.module || require('fng-jq-upload').Controller;
this.fileUploader = new JqUploadModule(this, processArgs, this.options.JQMongoFileUploader);
void (this.fileUploader); // suppress warning
}
};
示例9:
this.http.get(url).forEach(response => {
var tempState = window.history.state;
let a = response.json();
if(a.data[0] !== "Authorized") {
this.appState.set('authenticated', true);
this.appState.set('learn', true);
this.router.navigate(['/welcome']);
window.history.replaceState(null, null, '');
} else {
this.appState.set('authenticated', true);
this.appState.set('isDisabled', false);
this.router.navigate(['/'+page]);
tempState = _.extend(tempState, this.appState._state);
console.log('temp', tempState);
window.history.pushState(tempState, null, page);
}
}).catch(err => console.log("ERROR:", err));