asset

package
v5.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2024 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFilteredWordList

func GetFilteredWordList(key string, minLen int, maxLen int) ([]string, error)

GetFilteredWordList reads a word list from an embedded file identified by the given key, and filters the words based on the specified minimum and maximum length. It returns a slice of strings that meet the length criteria. If the file cannot be opened or read, or if an error occurs during scanning, an error is returned.

func GetJSONPreset

func GetJSONPreset(key string) (map[string]any, error)

GetJSONPreset reads a JSON preset file identified by the given key from embedded files. It returns the content of the JSON file as a map, if not an error is returned.

func GetWordList

func GetWordList(key string) ([]string, error)

GetWordList retrieves a list of words from an embedded file identified by the given key. The method reads the file content, splits it by newline characters and returns the result as a slice of strings. If the file cannot be found or read, an error is returned.

func LoadJSONFile

func LoadJSONFile(filePath string) (map[string]any, error)

LoadJSONFile reads a JSON file from the given file path and returns its content as a map. In case of any error during these operations, an error is returned

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL