4 examples of 'lodash first' in JavaScript

Every line of 'lodash first' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
127function _first(values) {
128 return values[0];
129}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

9export function first<T>(array: T[]): T {
10 if (!array.length)
11 return undefined;
12 return array[0];
13}
28function first(a) {
29 return a.length > 0 ? a[0] : null;
30}
153function first(arr) {
154 return arr[0];
155}

Related snippets