list.d.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. export type List = {
  2. /**
  3. * Safely splits values.
  4. *
  5. * ```js
  6. * Once (root, { list }) {
  7. * list.split('1px calc(10% + 1px)', [' ', '\n', '\t']) //=> ['1px', 'calc(10% + 1px)']
  8. * }
  9. * ```
  10. *
  11. * @param string separated values.
  12. * @param separators array of separators.
  13. * @param last boolean indicator.
  14. * @return Split values.
  15. */
  16. split(string: string, separators: string[], last: boolean): string[]
  17. /**
  18. * Safely splits space-separated values (such as those for `background`,
  19. * `border-radius`, and other shorthand properties).
  20. *
  21. * ```js
  22. * Once (root, { list }) {
  23. * list.space('1px calc(10% + 1px)') //=> ['1px', 'calc(10% + 1px)']
  24. * }
  25. * ```
  26. *
  27. * @param str Space-separated values.
  28. * @return Split values.
  29. */
  30. space(str: string): string[]
  31. /**
  32. * Safely splits comma-separated values (such as those for `transition-*`
  33. * and `background` properties).
  34. *
  35. * ```js
  36. * Once (root, { list }) {
  37. * list.comma('black, linear-gradient(white, black)')
  38. * //=> ['black', 'linear-gradient(white, black)']
  39. * }
  40. * ```
  41. *
  42. * @param str Comma-separated values.
  43. * @return Split values.
  44. */
  45. comma(str: string): string[]
  46. }
  47. declare const list: List
  48. export default list