How to use the boolean.boolean function in boolean

To help you get started, we’ve selected a few boolean 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 gajus / roarr / src / log.js View on Github external
import environmentIsNode from 'detect-node';
import {
  createLogger,
  createMockLogger,
  createRoarrInititialGlobalState,
} from './factories';

const globalThis = createGlobalThis();

globalThis.ROARR = createRoarrInititialGlobalState(globalThis.ROARR || {});

let logFactory = createLogger;

if (environmentIsNode) {
  // eslint-disable-next-line no-process-env
  const enabled = boolean(process.env.ROARR_LOG || '');

  if (!enabled) {
    logFactory = createMockLogger;
  }
}

export type {
  LoggerType,
  MessageType,
  TranslateMessageFunctionType,
} from './types';

export default logFactory((message) => {
  if (globalThis.ROARR.write) {
    // Stringify message as soon as it is received to prevent
    // properties of the context from being modified by reference.
github forwardemail / free-email-forwarding / index.js View on Github external
Array.isArray(this.dnsbl.domains) &&
      Array.isArray(this.dnsbl.removals) &&
      this.dnsbl.domains.length !== this.dnsbl.removals.length
    )
      throw new Error('DNSBL_DOMAINS length must be equal to DNSBL_REMOVALS');

    if (this.config.ssl) {
      this.config.ssl.minVersion = 'TLSv1';
      this.config.ssl.ciphers = tls
        .getCiphers()
        .map(cipher => cipher.toUpperCase())
        .join(':');
      this.config.ssl.secureOptions =
        crypto.constants.SSL_OP_NO_SSLv3 | crypto.constants.SSL_OP_NO_SSLv2;
      delete this.config.ssl.allowHTTP1;
      if (boolean(process.env.IS_NOT_SECURE)) this.config.ssl.secure = false;
      else this.config.ssl.secure = true;
    }

    this.config.smtp = {
      ...this.config.smtp,
      ...this.config.ssl
    };

    // set up DKIM instance for signing messages
    this.dkim = new DKIM(this.config.dkim);

    // initialize redis
    const client = new Redis(
      this.config.redis,
      logger,
      this.config.redisMonitor
github ladjs / lad / template / routes / web / auth.js View on Github external
.get(
    '/:provider/ok',
    policies.ensureLoggedOut,
    web.auth.catchError,
    (ctx, next) => {
      const redirect = ctx.session.returnTo
        ? ctx.session.returnTo
        : `/${ctx.locale}${config.passportCallbackOptions.successReturnToOrRedirect}`;
      return passport.authenticate(ctx.params.provider, {
        ...config.passportCallbackOptions,
        successReturnToOrRedirect: redirect
      })(ctx, next);
    }
  );

if (boolean(process.env.AUTH_GOOGLE_ENABLED)) {
  router.get(
    '/google/consent',
    policies.ensureLoggedOut,
    web.auth.catchError,
    passport.authenticate('google', {
      accessType: 'offline',
      prompt: 'consent', // See google strategy in passport helper
      scope: [
        'https://www.googleapis.com/auth/userinfo.email',
        'https://www.googleapis.com/auth/userinfo.profile'
      ]
    })
  );
}

module.exports = router;
github gajus / global-agent / src / factories / createGlobalProxyAgent.js View on Github external
const createConfiguration = (configurationInput: ProxyAgentConfigurationInputType): ProxyAgentConfigurationType => {
  // eslint-disable-next-line no-process-env
  const environment = process.env;

  const defaultConfiguration = {
    environmentVariableNamespace: typeof environment.GLOBAL_AGENT_ENVIRONMENT_VARIABLE_NAMESPACE === 'string' ? environment.GLOBAL_AGENT_ENVIRONMENT_VARIABLE_NAMESPACE : 'GLOBAL_AGENT_',
    forceGlobalAgent: typeof environment.GLOBAL_AGENT_FORCE_GLOBAL_AGENT === 'string' ? parseBoolean(environment.GLOBAL_AGENT_FORCE_GLOBAL_AGENT) : true,
    socketConnectionTimeout: typeof environment.GLOBAL_AGENT_SOCKET_CONNECTION_TIMEOUT === 'string' ? parseInt(environment.GLOBAL_AGENT_SOCKET_CONNECTION_TIMEOUT, 10) : defaultConfigurationInput.socketConnectionTimeout,
  };

  // $FlowFixMe
  return {
    ...defaultConfiguration,
    ...omitUndefined(configurationInput),
  };
};
github niftylettuce / frisbee / src / index.js View on Github external
this.opts.baseURI ? ` from ${this.opts.baseURI}` : ''
          }`
        )
    });

    if (opts.arrayFormat) {
      this.opts.parse.arrayFormat = 'indices';
      delete opts.arrayFormat;
    }

    if (Array.isArray(opts.preventBodyOnMethods))
      this.opts.preventBodyOnMethods = this.opts.preventBodyOnMethods.map(
        method => method.toUpperCase().trim()
      );

    this.opts.raw = boolean(this.opts.raw);

    if (this.opts.auth) this.auth(this.opts.auth);

    METHODS.forEach(method => {
      this[method.toLowerCase()] = this._setup(method.toLowerCase());
    });

    // alias for `this.del` -> `this.delete`
    this.del = this._setup('delete');

    // interceptor should be initialized after methods setup
    this.interceptor = new Interceptor(this, this.opts.interceptableMethods);

    // bind scope to method
    this.setOptions = this.setOptions.bind(this);
    this.auth = this.auth.bind(this);
github cabinjs / axe / src / index.js View on Github external
endpoint,
        headers: {},
        timeout: 5000,
        retry: 3,
        showStack: process.env.SHOW_STACK
          ? boolean(process.env.SHOW_STACK)
          : true,
        showMeta: process.env.SHOW_META ? boolean(process.env.SHOW_META) : true,
        silent: false,
        logger: console,
        name: false,
        level: 'info',
        levels: ['info', 'warn', 'error', 'fatal'],
        capture: process.browser ? false : env === 'production',
        callback: false,
        appInfo: process.env.APP_INFO ? boolean(process.env.APP_INFO) : true
      },
      config
    );

    this.appInfo = this.config.appInfo
      ? isFunction(parseAppInfo)
        ? parseAppInfo()
        : false
      : false;

    this.log = this.log.bind(this);

    // inherit methods from parent logger
    const methods = Object.keys(this.config.logger).filter(
      key => !omittedLoggerKeys.includes(key)
    );
github cabinjs / axe / src / index.js View on Github external
constructor(config = {}) {
    this.config = Object.assign(
      {
        key: '',
        endpoint,
        headers: {},
        timeout: 5000,
        retry: 3,
        showStack: process.env.SHOW_STACK
          ? boolean(process.env.SHOW_STACK)
          : true,
        showMeta: process.env.SHOW_META ? boolean(process.env.SHOW_META) : true,
        silent: false,
        logger: console,
        name: false,
        level: 'info',
        levels: ['info', 'warn', 'error', 'fatal'],
        capture: process.browser ? false : env === 'production',
        callback: false,
        appInfo: process.env.APP_INFO ? boolean(process.env.APP_INFO) : true
      },
      config
    );

    this.appInfo = this.config.appInfo
      ? isFunction(parseAppInfo)
github ladjs / lad / template / app / models / user.js View on Github external
User.virtual(config.userFields.verificationPinHasExpired).get(function() {
  return boolean(
    !this[config.userFields.verificationPinExpiresAt] ||
      new Date(this[config.userFields.verificationPinExpiresAt]).getTime() <
        Date.now()
  );
});
github cabinjs / axe / src / index.js View on Github external
constructor(config = {}) {
    this.config = Object.assign(
      {
        key: '',
        endpoint,
        headers: {},
        timeout: 5000,
        retry: 3,
        showStack: process.env.SHOW_STACK
          ? boolean(process.env.SHOW_STACK)
          : true,
        showMeta: process.env.SHOW_META ? boolean(process.env.SHOW_META) : true,
        silent: false,
        logger: console,
        name: false,
        level: 'info',
        levels: ['info', 'warn', 'error', 'fatal'],
        capture: process.browser ? false : env === 'production',
        callback: false,
        appInfo: process.env.APP_INFO ? boolean(process.env.APP_INFO) : true
      },
      config
    );

    this.appInfo = this.config.appInfo
      ? isFunction(parseAppInfo)
        ? parseAppInfo()
        : false

boolean

boolean converts lots of things to boolean.

MIT
Latest version published 2 years ago

Package Health Score

71 / 100
Full package analysis

Popular boolean functions