UNPKG

als-store

Version:

Library for streamlined file management and advanced data caching, featuring intelligent file searching, dynamic cache control, and flexible file operations

17 lines (10 loc) 756 B
### Method: `first()` #### Overview: The `first(value=false)` method is an asynchronous function that retrieves the first file from the store based on the current options, similar to the `get()` method but specifically for the first file. **if value parameter set to true (false by default), return file with value.** #### Functionality: - This method is essentially a convenience function that sets the limit to 1, calls the `get()` method, and returns the first file (instance of File) in the results. #### Implementation Details: - Sets the `limit` option to 1 to ensure only the first file is fetched. - Calls the `get()` method to retrieve the file. - Returns the first file in the results array or `null` if no files are found.