currency.js icon indicating copy to clipboard operation
currency.js copied to clipboard

Incorrect "format" function comments

Open chrisworman-pela opened this issue 5 years ago • 2 comments

The comments on the currency.format function appear to refer to a previous signature of the function. The function accepts a options parameter, but the comment refers to a useSymbol parameter.

The comments should be updated to describe the shape of the options object and how to use it.

  /**
   * Formats the value as a string according to the formatting settings.
   * @param {boolean} useSymbol - format with currency symbol
   * @returns {string}
   */
  format(options) {
    let { _settings } = this;

    if(typeof options === 'function') {
      return options(this, _settings);
    }

    return _settings.format(this, Object.assign({}, _settings, options));
  },

chrisworman-pela avatar Oct 15 '20 16:10 chrisworman-pela

Hey @scurker @chrisworman-pela can I contribute to this issue?

Ali-Aftab avatar Oct 29 '20 22:10 Ali-Aftab

Yes, feel free to add a PR!

scurker avatar Oct 30 '20 04:10 scurker