string/capitalize.js

  1. import { capitalize as _capitalize } from 'lodash'
  2. import { convert } from 'immutadot'
  3. /**
  4. * Converts the first character of string to upper case and the remaining to lower case.
  5. * @function
  6. * @memberof string
  7. * @param {Object} object The object to modify.
  8. * @param {Array|string} path The path of the property to set.
  9. * @return {Object} Returns the updated object.
  10. * @example capitalize({ nested: { a: "a string" } }, 'nested.a') // => { nested: { a: "A string" } }
  11. * @see {@link https://lodash.com/docs#capitalize|lodash.capitalize} for more information.
  12. * @since 1.0.0
  13. */
  14. const capitalize = convert(_capitalize)
  15. export { capitalize }