How to use defaults - 10 common examples

To help you get started, we’ve selected a few defaults examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github luqin / react-component-tools / src / index.js View on Github external
function prepareConfig(_config) {
  const pkg = readPackageJSON();
  const name = capitalize(camelCase(_config.component.pkgName || pkg.name));

  let config = defaults(_config, { alias: pkg.alias });

  // component
  config.component = defaults(config.component, {
    entry: './src/index.js',
    pkgName: pkg.name,
    name: name,
    dependencies: pkg.deps,
    src: './src',
    lib: './lib',
    dist: './dist',
  });

  config.bump = config.bump || {};
  config.bump = defaults(config.bump, {
    npm: true,
    bower: false,
github luqin / react-component-tools / src / index.js View on Github external
let config = defaults(_config, { alias: pkg.alias });

  // component
  config.component = defaults(config.component, {
    entry: './src/index.js',
    pkgName: pkg.name,
    name: name,
    dependencies: pkg.deps,
    src: './src',
    lib: './lib',
    dist: './dist',
  });

  config.bump = config.bump || {};
  config.bump = defaults(config.bump, {
    npm: true,
    bower: false,
  });

  // example
  if (config.example) {
    if (config.example === true) {
      config.example = {};
    }

    defaults(config.example, {
      dist: './examples/dist',
      entry: './examples/src/app.js',
      files: [],

      port: 8888,
github js-rcon / react-console-emulator / lib / Terminal.jsx View on Github external
render () {
    const styles = {
      container: defaults(this.props.style, sourceStyles.container),
      content: defaults(this.props.contentStyle, sourceStyles.content),
      inputArea: defaults(this.props.inputAreaStyle, sourceStyles.inputArea),
      promptLabel: defaults(this.props.promptLabelStyle, sourceStyles.promptLabel),
      input: defaults(this.props.inputStyle, sourceStyles.input)
    }

    return (
      <div style="{styles.container}" name="{'react-console-emulator'}">
        {/* Content */}
        </div>
github luqin / react-component-tools / src / index.js View on Github external
dist: './dist',
  });

  config.bump = config.bump || {};
  config.bump = defaults(config.bump, {
    npm: true,
    bower: false,
  });

  // example
  if (config.example) {
    if (config.example === true) {
      config.example = {};
    }

    defaults(config.example, {
      dist: './examples/dist',
      entry: './examples/src/app.js',
      files: [],

      port: 8888,
      openBrowser: true,
    });

    let { entry, html } = config.example;

    if (typeof entry === 'string') {
      config.example.entry = {
        app: entry
      };
    }
github js-rcon / react-console-emulator / lib / Terminal.jsx View on Github external
render () {
    const styles = {
      container: defaults(this.props.style, sourceStyles.container),
      content: defaults(this.props.contentStyle, sourceStyles.content),
      inputArea: defaults(this.props.inputAreaStyle, sourceStyles.inputArea),
      promptLabel: defaults(this.props.promptLabelStyle, sourceStyles.promptLabel),
      input: defaults(this.props.inputStyle, sourceStyles.input)
    }

    return (
      <div style="{styles.container}" name="{'react-console-emulator'}">
        {/* Content */}
        </div>
github luqin / react-component-tools / src / index.js View on Github external
function prepareConfig(_config) {
  const pkg = readPackageJSON();
  const name = capitalize(camelCase(_config.component.pkgName || pkg.name));

  let config = defaults(_config, { alias: pkg.alias });

  // component
  config.component = defaults(config.component, {
    entry: './src/index.js',
    pkgName: pkg.name,
    name: name,
    dependencies: pkg.deps,
    src: './src',
    lib: './lib',
    dist: './dist',
  });

  config.bump = config.bump || {};
  config.bump = defaults(config.bump, {
    npm: true,
    bower: false,
  });

  // example
github pusher / pusher-js / src / core / config.ts View on Github external
export var getGlobalConfig = function() {
  return {
    wsHost: Defaults.host,
    wsPort: Defaults.ws_port,
    wssPort: Defaults.wss_port,
    httpHost: Defaults.sockjs_host,
    httpPort: Defaults.sockjs_http_port,
    httpsPort: Defaults.sockjs_https_port,
    httpPath: Defaults.sockjs_path,
    statsHost: Defaults.stats_host,
    authEndpoint: Defaults.channel_auth_endpoint,
    authTransport: Defaults.channel_auth_transport,
    // TODO make this consistent with other options in next major version
    activity_timeout: Defaults.activity_timeout,
    pong_timeout: Defaults.pong_timeout,
    unavailable_timeout: Defaults.unavailable_timeout
  };
};
github hapijs / hapi / lib-cov / defaults.js View on Github external
/* automatically generated by JSCoverage - do not edit */
if (typeof _$jscoverage === 'undefined') _$jscoverage = {};
if (! _$jscoverage['defaults.js']) {
  _$jscoverage['defaults.js'] = [];
  _$jscoverage['defaults.js'][9] = 0;
  _$jscoverage['defaults.js'][14] = 0;
  _$jscoverage['defaults.js'][58] = 0;
  _$jscoverage['defaults.js'][91] = 0;
  _$jscoverage['defaults.js'][92] = 0;
  _$jscoverage['defaults.js'][93] = 0;
  _$jscoverage['defaults.js'][94] = 0;
  _$jscoverage['defaults.js'][107] = 0;
}
_$jscoverage['defaults.js'][9]++;
var internals = {};
_$jscoverage['defaults.js'][14]++;
exports.process = {name: "Hapi Server", process: {}, log: {levels: {info: true, err: true}}, email: {fromName: "Hapi Server", replyTo: "no-reply@localhost", admin: "admin@localhost", server: {}}};
_$jscoverage['defaults.js'][58]++;
exports.server = {tos: {min: "19700101"}, payload: {maxBytes: 1048576}, cors: {maxAge: 86400}, ext: {onPreRoute: (function (req, res, next) {
github hapijs / hapi / lib-cov / defaults.js View on Github external
exports.server = {tos: {min: "19700101"}, payload: {maxBytes: 1048576}, cors: {maxAge: 86400}, ext: {onPreRoute: (function (req, res, next) {
  _$jscoverage['defaults.js'][91]++;
  next();
}), onPreHandler: (function (req, res, next) {
  _$jscoverage['defaults.js'][92]++;
  next();
}), onPostHandler: (function (req, res, next) {
  _$jscoverage['defaults.js'][93]++;
  next();
}), onPostRoute: (function (req, res, next) {
  _$jscoverage['defaults.js'][94]++;
  next();
}), onUnknownRoute: null}, authentication: null};
_$jscoverage['defaults.js'][107]++;
exports.authentication = {loadClientFunc: null, loadUserFunc: null, extensionFunc: null, checkAuthorizationFunc: null, tokenEndpoint: "/oauth/token", defaultAlgorithm: "hmac-sha-1", tokenLifetimeSec: 1209600, aes256Keys: {oauthRefresh: null, oauthToken: null}};
_$jscoverage['defaults.js'].source = ["/*","* Copyright (c) 2012 Walmart. All rights reserved. Copyrights licensed under the New BSD License.","* See LICENSE file included with this code project for license terms.","*/","","","// Declare internals","","var internals = {};","","","// Process configuration","","exports.process = {","","    name: 'Hapi Server',","","    // Process Configuration","","    process: {","","        // runAs: 'www-data',","    },","","    // Logging","","    log: {","","        levels: {","","            info: true,","            err: true","        }","    },","","    // Email Configuration","","    email: {","","        fromName: 'Hapi Server',","        replyTo: 'no-reply@localhost',","        admin: 'admin@localhost',","","        server: {","","            // port: 25,","            // user: '',","            // password: '',","            // host: 'localhost',","            // ssl: false","        }","    }","};","","","// Server configuration","","exports.server = {","","    // tls: {","    //","    //     key: '',","    //     cert: ''","    // },","","    // Terms of Service","","    tos: {","","        min: '19700101'","    },","","    // Payload","","    payload: {","","        maxBytes: 1024 * 1024","    },","","    // CORS","","    cors: {","","        maxAge: 86400                               // One day","    },","","    // Extensions","","    ext: {","","        onPreRoute: function (req, res, next) { next(); },              // New request, before any middleware","        onPreHandler: function (req, res, next) { next(); },            // Before route handler is called, after validation","        onPostHandler: function (req, res, next) { next(); },           // After route handler returns, before setting response","        onPostRoute: function (req, res, next) { next(); },             // After response sent","","        onUnknownRoute: null                                            // Overrides hapi's default handler. Signature: function (req, res) {}","    },","","    // Authentication (see exports.authentication for expected content)","","    authentication: null","};","","","// Authentication configuration","","exports.authentication = {","","    loadClientFunc: null,","    loadUserFunc: null,","    extensionFunc: null,","    checkAuthorizationFunc: null,","","    tokenEndpoint: '/oauth/token',","    defaultAlgorithm: 'hmac-sha-1',","    tokenLifetimeSec: 1209600,                  // Two weeks","","    aes256Keys: {","","        oauthRefresh: null,","        oauthToken: null","    }","};",""];
github hapijs / hapi / lib-cov / defaults.js View on Github external
/* automatically generated by JSCoverage - do not edit */
if (typeof _$jscoverage === 'undefined') _$jscoverage = {};
if (! _$jscoverage['defaults.js']) {
  _$jscoverage['defaults.js'] = [];
  _$jscoverage['defaults.js'][9] = 0;
  _$jscoverage['defaults.js'][14] = 0;
  _$jscoverage['defaults.js'][58] = 0;
  _$jscoverage['defaults.js'][91] = 0;
  _$jscoverage['defaults.js'][92] = 0;
  _$jscoverage['defaults.js'][93] = 0;
  _$jscoverage['defaults.js'][94] = 0;
  _$jscoverage['defaults.js'][107] = 0;
}
_$jscoverage['defaults.js'][9]++;
var internals = {};
_$jscoverage['defaults.js'][14]++;
exports.process = {name: "Hapi Server", process: {}, log: {levels: {info: true, err: true}}, email: {fromName: "Hapi Server", replyTo: "no-reply@localhost", admin: "admin@localhost", server: {}}};
_$jscoverage['defaults.js'][58]++;
exports.server = {tos: {min: "19700101"}, payload: {maxBytes: 1048576}, cors: {maxAge: 86400}, ext: {onPreRoute: (function (req, res, next) {
  _$jscoverage['defaults.js'][91]++;
  next();
}), onPreHandler: (function (req, res, next) {
  _$jscoverage['defaults.js'][92]++;
  next();
}), onPostHandler: (function (req, res, next) {
  _$jscoverage['defaults.js'][93]++;
  next();