function stringToPrefValue(value, pref) {
    switch (pref.type) {
      case chrome.settingsPrivate.PrefType.BOOLEAN:
        return value == 'true';
      case chrome.settingsPrivate.PrefType.NUMBER:
        const n = parseFloat(value);
        if (isNaN(n)) {
          console.error(
              'Argument to stringToPrefValue for number pref ' +
              'was unparsable: ' + value);
          return undefined;
        }
        return n;
      case chrome.settingsPrivate.PrefType.STRING:
      case chrome.settingsPrivate.PrefType.URL:
        return value;
      default:
        assertNotReached('No conversion from string to ' + pref.type + ' pref');
    }
  }
/**
   * Converts a string value to a type corresponding to the given preference.
   * @param {string} value
   * @param {!chrome.settingsPrivate.PrefObject} pref
   * @return {boolean|number|string|undefined}
   */
Converts a string value to a type corresponding to the given preference.
Converts a string value to a type corresponding to the given preference .
function stringToPrefValue(value, pref) {
    switch (pref.type) {
      case chrome.settingsPrivate.PrefType.BOOLEAN:
        return value == 'true';
      case chrome.settingsPrivate.PrefType.NUMBER:
        const n = parseFloat(value);
        if (isNaN(n)) {
          console.error(
              'Argument to stringToPrefValue for number pref ' +
              'was unparsable: ' + value);
          return undefined;
        }
        return n;
      case chrome.settingsPrivate.PrefType.STRING:
      case chrome.settingsPrivate.PrefType.URL:
        return value;
      default:
        assertNotReached('No conversion from string to ' + pref.type + ' pref');
    }
  }
function stringToPrefValue ( value , pref ) { switch ( pref . type ) { case chrome . settingsPrivate . PrefType . BOOLEAN : return value == 'true' ; case chrome . settingsPrivate . PrefType . NUMBER : const n = parseFloat ( value ) ; if ( isNaN ( n ) ) { console . error ( 'Argument to stringToPrefValue for number pref ' + 'was unparsable: ' + value ) ; return undefined ; } return n ; case chrome . settingsPrivate . PrefType . STRING : case chrome . settingsPrivate . PrefType . URL : return value ; default : assertNotReached ( 'No conversion from string to ' + pref . type + ' pref' ) ; } }
Converts a string value to a type corresponding to the given preference.
Converts a string value to a type corresponding to the given preference .