How to use the java-properties.of function in java-properties

To help you get started, we’ve selected a few java-properties 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 wpilibsuite / vscode-wpilib / vscode-wpilib / src / webviews / eclipseimport.ts View on Github external
private async handleImport(data: IEclipseIPCData) {
    if (!path.isAbsolute(data.toFolder)) {
      vscode.window.showErrorMessage('Can only extract to absolute path');
      return;
    }
    const oldProjectPath = path.dirname(data.fromProps);

    const cpp = await existsAsync(path.join(oldProjectPath, '.cproject'));

    // tslint:disable-next-line:no-unsafe-any
    const values = javaProperties.of(data.fromProps);

    // tslint:disable-next-line:no-unsafe-any
    const javaPackageRobotClass: string = values.get('robot.class', '');

    // tslint:disable-next-line:no-unsafe-any
    const javaRobotPackage: string = values.get('package', '');

    const javaRobotClass = javaPackageRobotClass.substr(javaRobotPackage.length + 1);

    let toFolder = data.toFolder;

    if (data.newFolder) {
      toFolder = path.join(data.toFolder, data.projectName);
    }

    try {
github wpilibsuite / vscode-wpilib / wpilib-utility-standalone / src / eclipseimport.ts View on Github external
export async function importProjectButtonClick() {
  (document.activeElement as HTMLElement).blur();
  const data: IImportProject = {
    fromProps: (document.getElementById('eclipseInput') as HTMLInputElement).value,
    newFolder: (document.getElementById('newFolderCB') as HTMLInputElement).checked,
    projectName: (document.getElementById('projectName') as HTMLInputElement).value,
    teamNumber: (document.getElementById('teamNumber') as HTMLInputElement).value,
    toFolder: (document.getElementById('projectFolder') as HTMLInputElement).value,
  };

  const oldProjectPath = path.dirname(data.fromProps);

  const cpp = await existsAsync(path.join(oldProjectPath, '.cproject'));

  // tslint:disable-next-line:no-unsafe-any
  const values = javaProperties.of(data.fromProps);

  // tslint:disable-next-line:no-unsafe-any
  const javaRobotClass: string = values.get('robot.class', '');

  let toFolder = data.toFolder;

  if (data.newFolder) {
    toFolder = path.join(data.toFolder, data.projectName);
  }

  try {
    await mkdirpAsync(toFolder);
  } catch {
    //
  }
github fimkrypto / mofowallet / app / scripts / providers / server-config-provider.js View on Github external
readConfig: function (path) {
      try {
        var values = properties.of(path);
        return values.objs;
      } catch (e) {
        console.log('Could not read config file', e);
        return {};
      }
    },
github pvdlg / env-ci / services / teamcity.js View on Github external
const safeReadProperties = filePath => {
	try {
		return javaProperties.of(filePath);
	} catch (_) {
		return undefined;
	}
};
github cinchapi / concourse / concourse-driver-node-js / src / client / index.js View on Github external
return (async (options) => {
    options = _$assign({}, options)
    const defaultOptions = {
      environment: '',
      host: 'localhost',
      password: 'admin',
      port: 1717,
      username: 'admin'
    }
    if (_$isString(options.prefs)) {
      options.prefs = path.resolve(options.prefs)
      const preferencesFileProperties = javaProperties.of(options.prefs)
      delete options.prefs
      const preferencesFileOptions = {
        environment: preferencesFileProperties.get('environment'),
        host: preferencesFileProperties.get('host'),
        password: preferencesFileProperties.get('password'),
        port: preferencesFileProperties.getInt('port'),
        username: preferencesFileProperties.get('username')
      }
      _$forEach(defaultOptions, (defaultOptionValue, optionKey) => {
        if (_$isUndefined(options[optionKey])) {
          options[optionKey] = (! _$isUndefined(preferencesFileOptions[optionKey])) ? preferencesFileOptions[optionKey] : defaultOptionValue
        }
      })
    } else {
      _$forEach(defaultOptions, (defaultOptionValue, optionKey) => {
        options[optionKey] = (! _$isUndefined(options[optionKey])) ? options[optionKey] : defaultOptionValue

java-properties

Reads and interpolates Java .properties files

MIT
Latest version published 5 years ago

Package Health Score

66 / 100
Full package analysis

Popular java-properties functions