Logo white

ADAM / AIAHTML5

Sign in
  • Sign in
  • Project
  • Files
  • Commits
  • Network
  • Graphs
  • Milestones
  • Issues
  • Merge Requests 14
  • Labels
  • Wiki
  • Snippets
  • AIAHTML5
  • ..
  • utils
  • array.js
  • new files came from develop
    1a5f0330
    Nikita Kulshreshtha authored
    2018-01-24 13:55:24 +0530  
    Browse Code ยป
array.js 225 Bytes
Edit Raw Blame History Permalink
1 2 3 4 5 6 7 8 9 10 11
export function findIndex ( array, fn ) {
	for ( let i = 0; i < array.length; i += 1 ) {
		if ( fn( array[i], i ) ) return i;
	}

	return -1;
}

export function find ( array, fn ) {
	return array[ findIndex( array, fn ) ];
}