/**
* @module @svizzle/utils/string_proto-string
*/
import * as _ from 'lamb';
/**
* Return the portion of the provided string between the provided indices (first included, second excluded).
* Note that indices can be negative.
* (named `sliceString` to avoid conflict with `Array.prototype.slice`)
* @see
{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice|String.prototype.slice},
{@link module:@svizzle/utils/array-[string-string].sliceStringAt|sliceStringAt}
*
* @function
* @arg {string} string
* @arg {number} beginIndex - The zero-based index at which to begin extraction
* @arg {number} endIndex - Optional. The zero-based index before which to end extraction. If negative, starts counting from the end.
* @return {string}
*
* @example
> sliceString('0123456789', 3)
'3456789'
> sliceString('0123456789', 3, 5)
'34'
> sliceString('0123456789', 3, -1)
'345678'
*
* @since 0.5.0
*/
export const sliceString = _.generic(String.prototype.slice);
/**
* Return a string by trimming white space from the provided string
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trim|String.prototype.trim}
*
* @function
* @arg {string} string
* @return {string}
*
* @example
> trim(' abc \n ')
'abc'
*
* @since 0.1.0
*/
export const trim = _.generic(String.prototype.trim);