How to use the @hapi/hoek.deepEqual function in @hapi/hoek

To help you get started, we’ve selected a few @hapi/hoek 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 glennjones / hapi-swagger / lib / definitions.js View on Github external
definition = internals.formatProperty(definition);

  // remove required if its not an array
  //if (definition.required && !Array.isArray(definition.required)) {
  //    delete definition.required;
  //}

  // remove unneeded properties
  delete definition.name;

  // find existing definition by this definitionName
  let foundDefinition = currentCollection[definitionName];
  if (foundDefinition) {
    // deep compare objects
    if (Hoek.deepEqual(foundDefinition, definition)) {
      // return existing definitionName if existing object is exactly the same
      out = definitionName;
    } else {
      // create new definition
      out = internals.append(definitionName, definition, currentCollection, true, settings);
    }
  } else {
    // create new definition
    out = internals.append(definitionName, definition, currentCollection, false, settings);
  }

  return out;
};
github glennjones / hapi-swagger / lib / definitions.js View on Github external
definition = internals.formatProperty(definition);

  // remove required if its not an array
  //if (definition.required && !Array.isArray(definition.required)) {
  //    delete definition.required;
  //}

  // remove unneeded properties
  delete definition.name;

  // find existing definition by this definitionName
  let foundDefinition = currentCollection[definitionName];
  if (foundDefinition) {
    // deep compare objects
    if (Hoek.deepEqual(foundDefinition, definition)) {
      // return existing definitionName if existing object is exactly the same
      out = definitionName;
    } else {
      // create new definition
      out = internals.append(definitionName, definition, currentCollection, true, settings);
    }
  } else {
    // create new definition
    out = internals.append(definitionName, definition, currentCollection, false, settings);
  }

  return out;
};
github hapijs / glue / test / index.js View on Github external
it('composes a server without modifying the manifest', async () => {

        const manifest = {
            register: {
                plugins: [
                    {
                        plugin: '../test/plugins/helloworld.js'
                    }
                ]
            }
        };
        const clone = Hoek.clone(manifest);

        const server = await Glue.compose(manifest);
        expect(server.plugins.helloworld).to.exist();
        expect(Hoek.deepEqual(manifest, clone)).to.equal(true);
    });
github hapijs / code / lib / index.js View on Github external
        : (a, b) => Hoek.deepEqual(a, b, settings);
github academia-de-codigo / noire-server / lib / plugins / mailer.js View on Github external
internals.createTransport = async function() {
    Hoek.assert(process.env.SMTP_USER && process.env.SMTP_PASS, 'smtp configuration not found');
    Hoek.assert(Hoek.deepEqual(internals.templates, {}) === false, 'email templates not found');

    try {
        const transporter = NodeMailer.createTransport({
            host: Config.smtp.host,
            port: Config.smtp.port,
            auth: {
                user: process.env.SMTP_USER,
                pass: process.env.SMTP_PASS
            },
            debug: Config.debug,
            logger: Logger,
            disableFileAccess: true
        });

        if (Config.smtp.test) {
            Logger.child({ host: Config.smtp.host, port: Config.smtp.port }).info('mailer test');