How to use the dot-prop.get function in dot-prop

To help you get started, we’ve selected a few dot-prop 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 liferay / liferay-js-toolkit / packages / liferay-npm-build-tools-common / src / project / misc.ts View on Github external
get maxParallelFiles(): number {
		const {npmbundlerrc} = this._project;

		// Default values for "ulimit -n" vary across different OSes. Some
		//
		// values I have found are:
		//   - Apparently Mac OS X limit is 256 but usually people increase it
		//   - Fedora: 1024
		//   - Windows: there's no ulimit, but MSVCRT.DLL has a 2048 limit
		//
		// Given this mess and the impossibility of retrieving the limit from
		// Node, I'm giving this a default value of 128 because it looks like it
		// doesn't impact performance and should be low enough to make it work
		// in all OSes.
		return prop.get(npmbundlerrc, 'max-parallel-files', 128);
	}
github vivocha / arrest / src / utils.ts View on Github external
// or, if ref path is like:  #/components/schemas/A/properties/a
            type = refPath[refPath.length - 4];
          }

          if (['schemas', 'parameters', 'responses'].includes(refPath[refPath.length - 2])) {
            // in case of a ref like #/components/schemas/A or #/components/parameters/A or #/components/responses/A
            // schema name is the last element of the path
            schemaName = refPath[refPath.length - 1];
          } else if (refPath[refPath.length - 2] === 'properties') {
            // in case of a ref like #/components/schemas/A/properties/B
            // schema name is A, then:
            schemaName = refPath[refPath.length - 3];
          }
          if (['schemas', 'parameters', 'responses'].includes(type)) {
            // check if the reference points to an existing path in spec
            if (!dot.get(spec as any, refPath.slice(1).join('.'))) {
              throw new Error(`Referenced path "${obj[key]}" doesn't exist in spec.`);
            } else {
              occurrences[type][schemaName]['count'] += 1;
              occurrences[type][schemaName]['referencedBy'].push(currentPath.slice(0, 3).join('.'));
            }
          }
        }
        const prop = obj[key];
        // recursively find and count...
        if (prop && typeof prop === 'object') {
          if (!Array.isArray(prop)) {
            if (!parsedProps.find(p => p === prop)) {
              parsedProps.push(prop);
              findAndCount(prop, currentPath);
            }
          } else {
github vivocha / arrest / src / utils.ts View on Github external
function rebaseOASDefinition(fullSpec: any, schemaKey: string, schema: any, path: string, definitionsPath: string[]): any {
  if (schema.definitions) {
    for (const defKey in schema.definitions) {
      // current recursive definition path chain
      const chain = [...definitionsPath, defKey];
      const newPath = `${path}.definitions.${defKey}`;
      const definition = dot.get(fullSpec, newPath);
      fullSpec = rebaseOASDefinition(fullSpec, defKey, definition, newPath, chain);
      const newSchemaName = `${chain.join('_')}`;
      // move to components/schemas and get a new ref related to the new path
      fullSpec = moveDefinition(fullSpec, newSchemaName, newPath);
    }
    dot.delete(fullSpec, `${path}.definitions`);
  }
  return fullSpec;
}
github integreat-io / integreat / lib / utils / retrieveFromPath.js View on Github external
module.exports = function retrieveFromPath (item, path) {
  return dotProp.get(item, (path === '') ? null : path)
}
github akameco / PixivDeck / app / locale / index.js View on Github external
export default (str: string) => {
	return dotProp.get(obj, str)
}
github liferay / liferay-js-toolkit / packages / liferay-npm-bundler / src / config / internal / jar.js View on Github external
export function getConfigurationFile() {
	const jarConfig = getNormalizedJarConfig();

	let defaultValue = undefined;

	if (fs.existsSync('./features/configuration.json')) {
		defaultValue = 'features/configuration.json';
	}

	return prop.get(jarConfig, 'features.configuration', defaultValue);
}
github ufologist / model-adapter / dist / model-adapter.esm.js View on Github external
this.$getSource = function (propertyPath) {
    if (propertyPath) {
      return dotProp.get(_source, propertyPath);
    } else {
      return _source;
    }
  };
  /**
github evocateur / pectin / packages / rollup-plugin-subpath-externals / lib / rollup-plugin-subpath-externals.js View on Github external
module.exports = function subpathExternals(pkg, output) {
    const external = dotProp.get(pkg, 'rollup.external');
    const bundled = dotProp.get(pkg, 'rollup.bundle');
    const { format } = output || {};
    const { dependencies = {}, peerDependencies = {} } = pkg;

    let pkgDeps;

    if (external) {
        pkgDeps = external;
    } else if (format === 'umd') {
        pkgDeps = Object.keys(peerDependencies);
    } else {
        pkgDeps = Object.keys(dependencies).concat(Object.keys(peerDependencies));
    }

    if (bundled) {
        const inlined = new Set(bundled);
github liferay / liferay-js-toolkit / packages / generator-liferay-bundle / src / utils / modifier / npmbuildrc.js View on Github external
this.modifyJson(json => {
			let test = regex.toString();

			test = test.substring(1, test.length - 1);

			const currentRules = prop.get(json, 'webpack.rules', []);

			currentRules.push({
				test,
				use: loader,
			});

			prop.set(json, 'webpack.rules', currentRules);
		});
	}
github mvdicarlo / postybirb / src / app / websites / helpers / website-validator.helper.ts View on Github external
export function getTags(submission: Submission, website: string): string[] {
  let tags: string[] = dotProp.get(submission.formData, 'defaults.tags.tags', []);
  const customTags: TagData = dotProp.get(submission.formData, `${website}.tags`, { extend: true }) || { extend: true };
  if (customTags.extend) {
    tags = [...tags, ...(customTags.tags || [])];
  } else {
    tags = (customTags.tags || []);
  }

  return tags;
}

dot-prop

Get, set, or delete a property from a nested object using a dot path

MIT
Latest version published 3 months ago

Package Health Score

80 / 100
Full package analysis