mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-05-19 18:58:03 +02:00
refactor: naming cleanup and crypto package improvements (#551)
* refactor: naming cleanup across all packages
This commit is contained in:
@@ -8,8 +8,8 @@ import (
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
// IsFileExists checks if the file exists in the provided path
|
||||
func IsFileExists(filename string) bool {
|
||||
// FileExists checks if the file exists in the provided path.
|
||||
func FileExists(filename string) bool {
|
||||
info, err := os.Stat(filename)
|
||||
if os.IsNotExist(err) {
|
||||
return false
|
||||
@@ -1,34 +0,0 @@
|
||||
package typeutil
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
func Reverse[T any](s []T) []T {
|
||||
h := make([]T, len(s))
|
||||
for i := 0; i < len(s); i++ {
|
||||
h[i] = s[len(s)-i-1]
|
||||
}
|
||||
return h
|
||||
}
|
||||
|
||||
func TimeStamp(stamp int64) time.Time {
|
||||
s := time.Unix(stamp, 0)
|
||||
if s.Local().Year() > 9999 {
|
||||
return time.Date(9999, 12, 13, 23, 59, 59, 0, time.Local)
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
func TimeEpoch(epoch int64) time.Time {
|
||||
maxTime := int64(99633311740000000)
|
||||
if epoch > maxTime {
|
||||
return time.Date(2049, 1, 1, 1, 1, 1, 1, time.Local)
|
||||
}
|
||||
t := time.Date(1601, 1, 1, 0, 0, 0, 0, time.Local)
|
||||
d := time.Duration(epoch)
|
||||
for i := 0; i < 1000; i++ {
|
||||
t = t.Add(d)
|
||||
}
|
||||
return t
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package typeutil
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestReverse(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
reverseTestCases := [][]any{
|
||||
{1, 2, 3, 4, 5},
|
||||
{"1", "2", "3", "4", "5"},
|
||||
{"1", 2, "3", "4", 5},
|
||||
}
|
||||
|
||||
for _, ts := range reverseTestCases {
|
||||
h := Reverse(ts)
|
||||
for i := 0; i < len(ts); i++ {
|
||||
if h[len(h)-i-1] != ts[i] {
|
||||
t.Errorf("reverse failed %v != %v", h, ts)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user