index.d.ts 547 B

1234567891011121314151617181920212223242526272829
  1. /**
  2. Split a string on the first occurrence of a given separator.
  3. @param string - The string to split.
  4. @param separator - The separator to split on.
  5. @example
  6. ```
  7. import splitOnFirst = require('split-on-first');
  8. splitOnFirst('a-b-c', '-');
  9. //=> ['a', 'b-c']
  10. splitOnFirst('key:value:value2', ':');
  11. //=> ['key', 'value:value2']
  12. splitOnFirst('a---b---c', '---');
  13. //=> ['a', 'b---c']
  14. splitOnFirst('a-b-c', '+');
  15. //=> ['a-b-c']
  16. ```
  17. */
  18. declare function splitOnFirst(
  19. string: string,
  20. separator: string
  21. ): [string, string?];
  22. export = splitOnFirst;