list.d.ts 1.4 KB

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