• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript deepmerge.default函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中deepmerge.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了default函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: loadFile

export const load = (
  name: string,
  defaultConfig: any = {},
  noCache?: boolean
) => {
  let file = {}
  const filepath = findup.sync(finds(name))

  if (filepath) {
    file = loadFile(filepath, defaultConfig, noCache)
  }

  return defaultConfig !== null ? merge(defaultConfig, file) : file
}
开发者ID:leslieSie,项目名称:docz,代码行数:14,代码来源:index.ts


示例2: function

export default function(givenInitialState: Partial<State> = {}) {
  const initialState = merge(getInitialState(), givenInitialState);
  const epicMiddleware = createEpicMiddleware();
  const composeEnhancers =
    (typeof window !== "undefined" &&
      (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) ||
    compose;

  const store = createStore(
    reducer,
    initialState,
    composeEnhancers(applyMiddleware(epicMiddleware, errorMiddleware))
  );
  epicMiddleware.run(epics);
  return store;
}
开发者ID:nteract,项目名称:play,代码行数:16,代码来源:createStore.ts


示例3: async

export default async (args: Args) => {
  args = merge<Args>(
    {
      options: {
        env: {
          NODE_ENV: process.env.NODE_ENV || 'development',
        },
      },
      middleware: [],
    },
    args
  )

  const compiler = await run('inspect', args)
  // tslint:disable-next-line:no-console
  console.log(compiler)
}
开发者ID:aranja,项目名称:tux,代码行数:17,代码来源:inspect.ts


示例4: async

export default async (args: Args) => {
  args = merge<Args>(
    {
      options: {
        env: {
          NODE_ENV: process.env.NODE_ENV || 'production',
        },
      },
      middleware: [],
    },
    args
  )

  const spinner = ora('Building project').start()
  let result
  try {
    result = await run('build', args)
  } catch (err) {
    spinner.fail('Failed to compile.')
    printBuildError(err)
    process.exit(1)
  }

  const { warnings } = result
  if (warnings.length) {
    spinner.warn('Compiled with warnings.')
    // tslint:disable-next-line:no-console
    console.log(warnings.join('\n\n'))
    // tslint:disable-next-line:no-console
    console.log(
      '\nSearch for the ' +
        chalk.underline(chalk.yellow('keywords')) +
        ' to learn more about each warning.'
    )
    // tslint:disable-next-line:no-console
    console.log(
      'To ignore, add ' +
        chalk.cyan('// eslint-disable-next-line') +
        ' to the line before.\n'
    )
  } else {
    spinner.succeed('Compiled successfully.')
  }
}
开发者ID:aranja,项目名称:tux,代码行数:44,代码来源:build.ts


示例5: async

export default async (args: Args) => {
  const serverOptions = await getServerOptions(args)
  const protocol = serverOptions.https ? 'https' : 'http'
  const url = `${protocol}://${serverOptions.host}:${serverOptions.port}`

  args = merge<Args>(
    {
      options: {
        env: {
          NODE_ENV: process.env.NODE_ENV || 'development',
        },
      },
      middleware: [],
    },
    args
  )

  if (isInteractive) {
    clearConsole()
  }
  const spinner = ora('Compiling project').start()
  let multiCompiler: MultiCompiler
  try {
    multiCompiler = await run('start', args)
  } catch (err) {
    spinner.fail('Failed to compile')
    // tslint:disable:no-console
    console.log()
    console.log(err.stackTrace || err)
    console.log()
    // tslint:enable:no-console
    throw exitProcess(1)
  }

  const server = new Server({
    multiCompiler,
    ...serverOptions,
  })
  await server.listen()

  spinner.succeed(`Development server running on: ${url}`)
  openBrowser(url)

  const building = ora('Waiting for initial compilation to finish').start()
  multiCompiler.plugin('done', (stats: Stats) => {
    if (isInteractive) {
      clearConsole()
    }

    // We have switched off the default Webpack output in WebpackDevServer
    // options so we are going to "massage" the warnings and errors and present
    // them in a readable focused way.
    const messages = formatWebpackMessages(stats.toJson())
    const isSuccessful = !messages.errors.length && !messages.warnings.length
    if (isSuccessful) {
      building.succeed(`Compiled successfully!`)
    }

    // If errors exist, only show errors.
    if (messages.errors.length) {
      // Only keep the first error. Others are often indicative
      // of the same problem, but confuse the reader with noise.
      if (messages.errors.length > 1) {
        messages.errors.length = 1
      }
      building.fail(`Failed to compile`)
      // tslint:disable-next-line:no-console
      console.log(messages.errors.join('\n\n'))
      return
    }

    // Show warnings if no errors were found.
    if (messages.warnings.length) {
      building.warn('Compiled with warnings')
      // tslint:disable-next-line:no-console
      console.log(messages.warnings.join('\n\n'))

      // Teach some ESLint tricks.
      // tslint:disable-next-line:no-console
      console.log(
        '\nSearch for the ' +
          chalk.underline(chalk.yellow('keywords')) +
          ' to learn more about each warning.'
      )
      // tslint:disable-next-line:no-console
      console.log(
        'To ignore, add ' +
          chalk.cyan('// eslint-disable-next-line') +
          ' to the line before.\n'
      )
    }
  })

  multiCompiler.plugin('invalid', () => {
    if (isInteractive) {
      clearConsole()
    }
    building.text = 'Compiling...'
    building.start()
  })
//.........这里部分代码省略.........
开发者ID:aranja,项目名称:tux,代码行数:101,代码来源:start.ts


示例6: renderChart

export function renderChart(elementId: string, definition: any, data?: any) {
  if (definition.type === 'custom') {
    const chart = AmCharts.makeChart(elementId, definition.specification)

    return
  }

  // Clone/copy spec and data
  // Longer than normal conditional so setting as its own const
  const hasSpecAndIsntString = definition.specification && typeof definition.specification !== 'string'
  // ternary checking to see if there is a def.spec and that it is NOT a string (url)
  // if true than return def.spec. If not true than fetch a premade spec
  let spec = hasSpecAndIsntString ? clone(definition.specification) : fetchSpec(definition.type)
  const copyData = clone(data)

  // Set the spec's data
  spec.dataProvider = copyData

  // Apply the series
  if (!!definition.datasets) {
    spec = fillInSpec(spec, definition)
  }

  // Apply overrides
  if (definition.overrides) {
    // NOTE: this counts on using deepmerge < 2.x
    // see: https://github.com/KyleAMathews/deepmerge#arraymerge
    spec = deepmerge(spec, definition.overrides, { clone: true })
  }

  const chart = AmCharts.makeChart(elementId, spec)
  return
}
开发者ID:midwestmaverick,项目名称:cedar,代码行数:33,代码来源:render.ts


示例7: getOptions

function getOptions(command: Command, args: Args, target: Target) {
  return merge<Options>(
    {
      target,
      command,
      browserEntry: require.resolve('./entry-points/browser'),
      serverEntry: require.resolve('./entry-points/server'),
      mains: { index: 'app' },
      output: target === 'browser' ? 'build/static' : 'build/ssr',
      quiet: true,
    },
    args.options
  )
}
开发者ID:aranja,项目名称:tux,代码行数:14,代码来源:compiler.ts


示例8: reduce

export const babelrc = (args: Config): BabelRC => {
  const config = merge(load('babel', null), {
    babelrc: false,
    cacheDirectory: !args.debug,
    presets: [
      [require.resolve('babel-preset-react-app'), { flow: !args.typescript }],
      ...(args.typescript ? [require.resolve('@babel/preset-typescript')] : []),
    ],
    plugins: [],
  })

  const reduce = Plugin.reduceFromPlugins<BabelRC>(args.plugins)

  return reduce('modifyBabelRc', config)
}
开发者ID:leslieSie,项目名称:docz,代码行数:15,代码来源:babelrc.ts


示例9: return

  return (vuexStore: Store<IState>) => {
    const hydratedState: IState = {} as IState;

    storages.forEach((storage: IVuexPersistStorage): void => {
      if (canWriteStorage(storage)) {
        processStorage(storage, hydratedState, vuexStore);
      }
    });

    const mergedState: IState = merge(vuexStore.state, hydratedState, {
      clone:      false,
      arrayMerge: (store, saved) => {
        return saved;
      },
    });

    vuexStore.replaceState(mergedState);
  };
开发者ID:trungx,项目名称:vue-starter,代码行数:18,代码来源:vuex-persist.ts


示例10: merge

export const setupHappypack = (config: Config, args: Args, babelrc: any) => {
  const babelLoader: any = {
    loader: require.resolve('babel-loader'),
    options: merge(babelrc, {
      plugins: [require.resolve('react-hot-loader/babel')],
    }),
  }

  const jsx = {
    id: 'jsx',
    verbose: args.debug,
    loaders: [babelLoader],
  }

  if (args.propsParser && !args.typescript) {
    babelLoader.options.plugins.push(
      require.resolve('babel-plugin-react-docgen')
    )
  }

  if (args.propsParser && args.typescript) {
    jsx.loaders.push({
      loader: require.resolve('react-docgen-typescript-loader'),
    })
  }

  const mdx = {
    id: 'mdx',
    verbose: args.debug,
    loaders: [
      {
        loader: require.resolve('babel-loader'),
        options: babelrc,
      },
    ],
  }

  config.plugin('happypack-jsx').use(HappyPack, [jsx])
  config.plugin('happypack-mdx').use(HappyPack, [mdx])
}
开发者ID:leslieSie,项目名称:docz,代码行数:40,代码来源:loaders.ts



注:本文中的deepmerge.default函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript DefaultSubmissionClient.DefaultSubmissionClient类代码示例发布时间:2022-05-25
下一篇:
TypeScript deeplearn.train类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap