Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetNEvenlySpacedElements ¶
GetNEvenlySpacedElements returns n evenly spaced elements from the given array. The function takes an array of any type and an integer n as input. If the array is empty, it returns an empty array. The function calculates the step size based on the length of the array and n. It then selects the elements at the calculated indices and returns them in a new array.
func ReadFile ¶
ReadFile reads the content of a file specified by the filePath parameter. It returns the content of the file as a byte slice and an error if any occurred.
func SplitOnLastOccurence ¶
SplitOnLastOccurence splits the target string on the last occurrence of the specified delimiter. It returns a slice of strings where the first element is the substring before the delimiter, and the second element is the substring after the delimiter. If the delimiter is not found, it returns a slice containing the target string itself.
Types ¶
type MapSlice ¶
type MapSlice []MapItem
func (MapSlice) MarshalJSON ¶
MarshalJSON converts the MapSlice to its JSON representation. It marshals each key-value pair in the MapSlice to JSON and returns the resulting byte slice. The keys are converted to strings using the default formatting. The returned byte slice represents a JSON object. If an error occurs during marshaling, it returns nil and the error.
type PackageFile ¶
type PackageFile struct {
Name string `json:"name,omitempty"`
Version string `json:"version,omitempty"`
Description string `json:"description,omitempty"`
Dependencies map[string]string `json:"dependencies,omitempty"`
DevDependencies map[string]string `json:"devDependencies,omitempty"`
OptionalDependencies map[string]string `json:"optionalDependencies,omitempty"`
PeerDependencies map[string]string `json:"peerDependencies,omitempty"`
BundleDependencies []string `json:"bundleDependencies,omitempty"`
BundledDependencies []string `json:"bundledDependencies,omitempty"`
WorkSpaces []string `json:"workspaces"`
}
func ParsePackageFile ¶
func ParsePackageFile(filePath string) (PackageFile, string, error)
ParsePackageFile parses the package file located at the given file path and returns the parsed package file data, the raw package file data as a string, and any error encountered during the parsing process. The package file is expected to be in JSON format.