本文整理汇总了TypeScript中extend.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getPlugins
export default function getPlugins(o:WPACK_OPTS.Plugins,extensions:string[]){
const isProd = !!o.isProd;
const isDev = !isProd;
const isServer = !!o.isServer;
const isClient = !o.isServer;
const isDevServer = isClient && isDev;
const USES_TYPESCRIPT = extensions.indexOf('ts')>=0;
const doCopyFiles = isClient && isProd && ( o.copyFiles && o.copyFiles.from && o.copyFiles.to );
const copyConfig = doCopyFiles &&
{ from: o.copyFiles.from
, to: o.copyFiles.to
};
const doCompileStyles = isClient && isProd && ('stylesDestination' in o);
const GLOBS = buildGlobs(o);
return (
[ new webpack.DefinePlugin(GLOBS)
, isProd &&
new webpack.optimize.DedupePlugin()
, isProd &&
new webpack.optimize.OccurenceOrderPlugin(true)
, isDevServer &&
new webpack.NoErrorsPlugin()
, isDevServer &&
new webpack.HotModuleReplacementPlugin()
, isServer && isDev &&
new webpack.BannerPlugin
( 'require("source-map-support").install();'
, { raw: true, entryOnly: false }
)
, isClient && isProd &&
new webpack.optimize.UglifyJsPlugin(extend(true,{},uglifyDefaults,o.uglify))
, doCompileStyles &&
new ExtractTextPlugin(o.stylesDestination,extend(true,{},extractTextDefaults,o.extractText))
, doCopyFiles &&
new CopyWebpackPlugin
([ copyConfig ])
, USES_TYPESCRIPT &&
new ForkCheckerPlugin()
].filter(Boolean)
);
}
示例2: buildDevServer
export default function buildDevServer(contentBase:string,port:number,conf:any){
return extend
( true
, { contentBase, port }
, conf
)
}
示例3: function
test('missing arguments', function (t) {
t.deepEqual(extend(undefined, { a: 1 }), { a: 1 }, 'missing first argument is second argument');
t.deepEqual(extend({ a: 1 }), { a: 1 }, 'missing second argument is first argument');
t.deepEqual(extend(true, undefined, { a: 1 }), { a: 1 }, 'deep: missing first argument is second argument');
t.deepEqual(extend(true, { a: 1 }), { a: 1 }, 'deep: missing second argument is first argument');
t.deepEqual(extend(), {}, 'no arguments is object');
t.end();
});
示例4: readConfigFile
export function readConfigFile(configFile): Config {
var config: Config = extend({
karmaConfigFile: 'karma.conf.js',
config: {}
}, Try(() => readJsonFile(configFile)));
return config;
}