本文整理汇总了TypeScript中extend.default方法的典型用法代码示例。如果您正苦于以下问题:TypeScript extend.default方法的具体用法?TypeScript extend.default怎么用?TypeScript extend.default使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类extend
的用法示例。
在下文中一共展示了extend.default方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: buildConfig
export default function getPreset
( env:WPACK.ENV
, optionsFilename:string
, type:"server"|"client"
, isProd:boolean
, returnWebpackConfig:boolean=false
):WPACK.CONFIG | WEBPACK.CONFIG
{
const isServer = (type=='server');
const defFlags = Env_to_Opts( env );
const wpack_conf = Opts_to_WpackConf
( extend
( {}
, defFlags
, { bundleName:`${defFlags.bundleName}.${type}`
, outputPath:isServer ? `${defFlags.outputPath}` : `${defFlags.outputPath}/public`
, isServer
, isProd
}
)
, optionsFilename
);
return returnWebpackConfig ? buildConfig(wpack_conf) : wpack_conf;
}
示例2: it
it('should by default error when workingDirectory is a root directory with a package.json', done => {
const debug = new Debug({}, packageInfo);
/*
* `path.sep` represents a root directory on both Windows and Unix.
* On Windows, `path.sep` resolves to the current drive.
*
* That is, after opening a command prompt in Windows, relative to the
* drive C: and starting the Node REPL, the value of `path.sep`
* represents `C:\\'.
*
* If `D:` is entered at the prompt to switch to the D: drive before
* starting the Node REPL, `path.sep` represents `D:\\`.
*/
const root = path.sep;
const mockedDebuglet = proxyquire('../src/agent/debuglet', {
/*
* Mock the 'fs' module to verify that if the root directory is used,
* and the root directory is reported to contain a `package.json`
* file, then the agent still produces an `initError` when the
* working directory is the root directory.
*/
fs: {
stat: (
filepath: string | Buffer,
cb: (err: Error | null, stats: {}) => void
) => {
if (filepath === path.join(root, 'package.json')) {
// The key point is that looking for `package.json` in the
// root directory does not cause an error.
return cb(null, {});
}
fs.stat(filepath, cb);
},
},
});
const config = extend({}, defaultConfig, {workingDirectory: root});
const debuglet = new mockedDebuglet.Debuglet(debug, config);
let text = '';
debuglet.logger.error = (str: string) => {
text += str;
};
debuglet.on('initError', (err: Error) => {
const errorMessage =
'The working directory is a root ' +
'directory. Disabling to avoid a scan of the entire filesystem ' +
'for JavaScript files. Use config `allowRootAsWorkingDirectory` ' +
'if you really want to do this.';
assert.ok(err);
assert.strictEqual(err.message, errorMessage);
assert.ok(text.includes(errorMessage));
done();
});
debuglet.once('started', () => {
assert.fail('Should not start if workingDirectory is a root directory');
});
debuglet.start();
});
示例3: Table
/**
* Create a Table object.
*
* @param {string} id The ID of the table.
* @param {object} [options] Table options.
* @param {string} [options.location] The geographic location of the table, by
* default this value is inherited from the dataset. This can be used to
* configure the location of all jobs created through a table instance. It
* cannot be used to set the actual location of the table. This value will
* be superseded by any API responses containing location data for the
* table.
* @return {Table}
*
* @example
* const BigQuery = require('@google-cloud/bigquery');
* const bigquery = new BigQuery();
* const dataset = bigquery.dataset('institutions');
*
* const institutions = dataset.table('institution_data');
*/
table(id, options) {
options = extend(
{
location: this.location,
},
options
);
return new Table(this, id, options);
};
示例4: it
it('should extend defaults with custom options object passed to constructor', () => {
let expected = extend({}, defaultOptions, {
trigger: [new Trigger('click')],
text: 'hello world',
placement: 'bottom'
}); // copy
expect(deepEqual((new Options({
trigger: 'click',
text: expected.text,
placement: expected.placement
})), expected)).toBe(true);
});
示例5:
export default function buildDevServer
( contentBase:string
, port:number
, conf:any
):WEBPACK.DevServer
{
return makeDevServerOptions
( extend
( true
, { contentBase, port }
, conf
)
);
}
示例6: callback
(err, resp) => {
if (err) {
callback(err, null, null, resp);
return;
}
let rows = [];
if (resp.schema && resp.rows) {
rows = this.bigQuery.mergeSchemaWithRows_(resp.schema, resp.rows);
}
let nextQuery = null;
if (resp.jobComplete === false) {
// Query is still running.
nextQuery = extend({}, options);
} else if (resp.pageToken) {
// More results exist.
nextQuery = extend({}, options, {
pageToken: resp.pageToken,
});
}
callback(null, rows, nextQuery, resp);
}
示例7: extend
issues.forEach((value) => {
if (value.type === 'open') {
issuesObject = extend(true, issuesObject, { 'open': value.total });
}
else {
issuesObject = extend(true, issuesObject, { 'closed': value.total });
}
});
示例8: Dataset
BigQuery.prototype.dataset = function(id, options) {
if (this.location) {
options = extend({location: this.location}, options);
}
return new Dataset(this, id, options);
};
示例9: Job
BigQuery.prototype.job = function(id, options) {
if (this.location) {
options = extend({location: this.location}, options);
}
return new Job(this, id, options);
};
示例10: function
function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
let nextQuery = null;
if (resp.nextPageToken) {
nextQuery = extend({}, options, {
pageToken: resp.nextPageToken,
});
}
const jobs = (resp.jobs || []).map(function(jobObject) {
const job = that.job(jobObject.jobReference.jobId, {
location: jobObject.jobReference.location,
});
job.metadata = jobObject;
return job;
});
callback(null, jobs, nextQuery, resp);
}
示例11: constructor
constructor(options: any, edmx: Edm.Edmx) {
options = options || {};
this.options = extend({}, options)
this.metadata = edmx
}
示例12: it
it('should not include fractional digits if not provided', function() {
const input = extend({}, INPUT_OBJ);
delete input.fractional;
const time = bq.time(input);
assert.strictEqual(time.value, '14:2:38');
});
示例13: it
it('should use the credentials field of the options object', done => {
const options = extend(
{},
{
projectId: 'fake-project',
credentials: require('./fixtures/gcloud-credentials.json'),
}
);
const debug = new Debug(options, packageInfo);
const scope = nocks.oauth2(body => {
assert.strictEqual(body.client_id, options.credentials.client_id);
assert.strictEqual(body.client_secret, options.credentials.client_secret);
assert.strictEqual(body.refresh_token, options.credentials.refresh_token);
return true;
});
// Since we have to get an auth token, this always gets intercepted second.
nocks.register(() => {
scope.done();
setImmediate(done);
return true;
});
nocks.projectId('project-via-metadata');
// TODO: Determine how to remove this cast.
debuglet = new Debuglet(debug, (config as {}) as DebugAgentConfig);
debuglet.start();
});
示例14: extend
createMethod: (id, options, callback) => {
if (is.fn(options)) {
callback = options;
options = {};
}
options = extend({}, options, {location: this.location});
return bigQuery.createDataset(id, options, callback);
},
示例15: setMetadata
setMetadata(metadata: Metadata, callback?: ResponseCallback):
void|Promise<SetMetadataResponse> {
// tslint:disable-next-line:no-any
const protoOpts = (this.methods.setMetadata as any).protoOpts;
const reqOpts =
extend(true, {}, this.getOpts(this.methods.setMetadata), metadata);
this.request(protoOpts, reqOpts, callback || util.noop);
}