How to use the dot-object.object function in dot-object

To help you get started, we’ve selected a few dot-object 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 giper45 / DockerSecurityPlayground / app / data / docker-converter.js View on Github external
function JDCgetCapabilities(selectedImage) {
  const log = appUtils.getLogger();
  const returnCaps = [];
  if (!selectedImage.labels) {
    return [];
  }
  else {
    const convertedLabels = dot.object(selectedImage.labels);
    if (convertedLabels && convertedLabels.caps_add) {
      const convertedCaps = convertedLabels.caps_add.split(',');
      convertedCaps.forEach((cap) => {
        const cleanedCap = cap.trim();
        // If is a valid cap add
        if (dockerCapabilities.check(cleanedCap)) {
          returnCaps.push(cleanedCap);
        }
        else log.warn(`${cap} is not a valid cap! No converted`);
      });
      // TBD CHECK OF CAPS
      return returnCaps;
    }
    else return [];
  }
}
github Aluminati / meteor-react-autoform / src / autoform.js View on Github external
Object.keys(this.props.schema).map(fieldName =>
    {
      if(typeof state[`${fieldName}_fieldValue`] !== 'undefined' &&
        !(this.props.type === 'insert' && state[`${fieldName}_fieldValue`] === '') &&
        this.getDocumentValue(fieldName) !== this.getStateOrDefaultSchemaValue(fieldName, null, null, state))
      {
        formFields[fieldName] = this.getStateOrDefaultSchemaValue(fieldName, null, null, state); // Gets the state value

        if(fieldName.indexOf('.') > 0) // If this fieldName belongs to object
        {
          let fieldNameObj = Dot.object(Object.assign({}, {[fieldName]: formFields[fieldName]})), // Get the entire object
            // schemaKey = fieldName.substr(0, fieldName.lastIndexOf('.')); // Get the parent object key
            schemaKey = fieldName.substr(0, fieldName.indexOf('.')); // Get the parent object key

          Dot.copy(schemaKey, schemaKey, this.props.doc, fieldNameObj); // Copy the original object
          formFields = {...Dot.dot(fieldNameObj), ...formFields}; // Turn the original object into dotted object and then merge it with the new fieldName value
        }
      }
    });
github namics / generator-nitro / packages / nitro-app / app / core / router.js View on Github external
config.get('nitro.basePath'),
		config.get('nitro.viewDataDirectory'),
		`/${req.query._data}.json`
	) : false;

	if (customDataPath && fs.existsSync(customDataPath)) {
		extend(true, data, JSON.parse(fs.readFileSync(customDataPath, 'utf8')));
	} else if (fs.existsSync(dataPath)) {
		extend(true, data, JSON.parse(fs.readFileSync(dataPath, 'utf8')));
	}

	// handle query string parameters
	if (Object.keys(req.query).length !== 0) {
		// simple clone
		const reqQuery = JSON.parse(JSON.stringify(req.query));
		dot.object(reqQuery);
		extend(true, data, reqQuery);
		// save query for use in patterns
		data._query = reqQuery;
	}

	// layout handling
	if (data._layout) {
		if (utils.layoutExists(data._layout)) {
			data.layout = utils.getLayoutPath(data._layout);
		}
	}
	if (!data.layout || !utils.layoutExists(utils.getLayoutName(data.layout))) {
		// use default layout if present
		if (utils.layoutExists(config.get('nitro.defaultLayout'))) {
			data.layout = utils.getLayoutPath(config.get('nitro.defaultLayout'));
		}
github zhr85210078 / node-mongodb-es-connector / lib / util / crud.js View on Github external
elasticsearchPool.getConnection(url,httpAuth).then(function (client) {
      client.index({
        index: index,
        type: type,
        id: document_id,
        body: parser.object(document)
      }, function (error, response) {
        if (!error && !response.errors) {
          logger.info('Inserted document %s to %s/%s (index/type)', document_id, index, type);
          return resolve(true);
        } else {
          if (error) {
            logger.error('Document %s NOT inserted to %s/%s (index/type) because of "%s"\n%s', document_id, index, type, error.message, error.stack);
            return reject(error);
          }
          if (response.errors) {
            logger.warn('Document %s NOT inserted to %s/%s (index/type):\n%s', document_id, index, type, JSON.stringify(response.errors));
            return reject(response.errors);
          }
        }
      }).catch(function (err) {
        return reject(err);
github kiegroup / kie-cloud-operator / vendor / github.com / RHsyseng / console-cr-form / frontend / src / component / operator-wizard / OperatorWizard.js View on Github external
createResultYaml() {
    const jsonObject = this.createYamlFromPages();
    var resultYaml =
      "apiVersion: " +
      this.state.spec.apiVersion +
      "\n" +
      "kind: " +
      this.state.spec.kind +
      "\n";
    if (Object.getOwnPropertyNames(jsonObject).length > 0) {
      resultYaml = resultYaml + YAML.safeDump(Dot.object(jsonObject));
    }
    this.setState({
      resultYaml: resultYaml
    });
    return resultYaml;
  }
github stackscz / re-app / src / utils / parseFormFields.js View on Github external
internalConfig.validate = values => {
		var errors = validatejs(values, fieldValidationsConstraints);
		if (errors) {
			dot.object(errors);
		}
		return errors || {};
	};
github codediodeio / firestore-migrator / src / importCollection / index.ts View on Github external
_.forEach(json, row => {
        dot.object(row);
    });
    return json;
github zhr85210078 / node-mongodb-es-connector / lib / util / crud.js View on Github external
elasticsearchPool.getConnection(url,httpAuth).then(function (client) {
      client.update({
        index: index,
        type: type,
        id: document_id,
        body: {
          doc: parser.object(partialDocument)
        }
      }, function (error, response) {
        if (!error && !response.errors) {
          logger.info('Update %s in %s/%s (index/type)', document_id, index, type);
          return resolve(true);
        } else {
          if (error) {
            logger.error('Document %s to be updated but not found', document_id);
            return reject(error);
          }
          if (response.errors) {
            logger.warn('Document %s NOT updated to %s/%s (index/type):\n%s', document_id, index, type, JSON.stringify(response.errors));
            return reject(response.errors);
          }
        }
      }).catch(function (err) {

dot-object

dot-object makes it possible to transform and read (JSON) objects using dot notation.

MIT
Latest version published 8 months ago

Package Health Score

63 / 100
Full package analysis