mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-17 19:55:26 +00:00
40 lines
674 B
Go
40 lines
674 B
Go
package utils
|
|
|
|
import (
|
|
"errors"
|
|
"strings"
|
|
|
|
"github.com/projectdiscovery/fileutil"
|
|
)
|
|
|
|
func IsBlank(value string) bool {
|
|
return strings.TrimSpace(value) == ""
|
|
}
|
|
|
|
func IsNotBlank(value string) bool {
|
|
return !IsBlank(value)
|
|
}
|
|
|
|
func UnwrapError(err error) error {
|
|
for { // get the last wrapped error
|
|
unwrapped := errors.Unwrap(err)
|
|
if unwrapped == nil {
|
|
break
|
|
}
|
|
err = unwrapped
|
|
}
|
|
return err
|
|
}
|
|
|
|
func LoadFile(filename string) ([]string, error) {
|
|
var items []string
|
|
readfileChan, err := fileutil.ReadFile(filename)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
for includeIdLine := range readfileChan {
|
|
items = append(items, includeIdLine)
|
|
}
|
|
return items, nil
|
|
}
|