![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
github.com/benjivesterby/validator
Validator can be executed against any struct / interface to determine if it is valid.
To install:
go get -u go.devnw.com/validator
To use validator
go.devnw.com/validator
validator.Valid(obj1, obj2, ..., objN)
validator.Assert(obj1, obj2, ..., objN)
Valid()
returns a boolean indicating validity
Assert()
returns a nil error if the inputs are valid, and returns an error
for invalid arguments, and the error specifies the index of the erroneous value
To implement your own validator use the interface method Validate() bool
as
shown below:
import "go.devnw.com/validator"
type testStruct struct {
valid bool
}
// Implement the validate method on your struct
func(this testStruct) Validate() bool {
return this.valid
}
// This accepts an interface. If the interface passed to it is valid it returns true,
// otherwise it returns false.
validator.Valid(testStruct{true})
This library will check for nil first on any nillable type, then it uses a type switch to check for validity on known types.
For slices it will indicate which element of the slice that is passed in is
invalid when using Assert
Valid will also check individual slice indexes but will not indicate which is
invalid since it only returns a bool
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.