Skip to content

Instantly share code, notes, and snippets.

@szanata
Created May 18, 2019 19:07
Show Gist options
  • Save szanata/26b681eafcf5a2e964e5d61b24a93ce8 to your computer and use it in GitHub Desktop.
Save szanata/26b681eafcf5a2e964e5d61b24a93ce8 to your computer and use it in GitHub Desktop.
Spit & Trim
const firstIndexOf = ( c, ...vars ) => Math.min( ...vars.map( v => c.indexOf( v ) ).filter( n => n > -1 ) );
const lastIndexOf = ( c, ...vars ) => Math.max( ...vars.map( v => c.lastIndexOf( v ) ) );
utfString.split( '\0ustar' ).slice( 1 ).map( c =>
c.substring( firstIndexOf( c, '{', '[' ), lastIndexOf( c, '}', ']' ) + 1 )
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment