You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.2 KiB

2 years ago
  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