"Fossies" - the Fresh Open Source Software Archive

Member "node-v12.18.4-win-x86/node_modules/npm/node_modules/split-on-first/index.d.ts" (14 Feb 2020, 576 Bytes) of package /windows/www/node-v12.18.4-win-x86.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) TypeScript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

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