Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/igorskyflyer/go-adblock-filter-counter
๐ฒ A dead simple Go module that counts Adblock filter rules. Adaptation of my original npm/TypeScript package.๐ฆ
https://github.com/igorskyflyer/go-adblock-filter-counter
adblock adblock-filter back-end count counter filter go igorskyflyer module typescript utility
Last synced: 2 days ago
JSON representation
๐ฒ A dead simple Go module that counts Adblock filter rules. Adaptation of my original npm/TypeScript package.๐ฆ
- Host: GitHub
- URL: https://github.com/igorskyflyer/go-adblock-filter-counter
- Owner: igorskyflyer
- License: mit
- Created: 2023-07-13T22:15:54.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-07-15T20:24:14.000Z (over 1 year ago)
- Last Synced: 2023-09-05T03:04:43.008Z (about 1 year ago)
- Topics: adblock, adblock-filter, back-end, count, counter, filter, go, igorskyflyer, module, typescript, utility
- Language: Go
- Homepage: https://pkg.go.dev/github.com/igorskyflyer/go-adblock-filter-counter
- Size: 43.9 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# ๐ go := "Adblock filter counter"
๐ฒ A dead simple Go module that counts Adblock filter rules.๐ฆ
> Note: it only operates on a string-level, it doesn't check the validity of the provided filter rules.
Documentation: https://godocs.io/github.com/igorskyflyer/go-adblock-filter-counter
See the [releases](https://github.com/igorskyflyer/go-adblock-filter-counter/releases) page for a changelog.
This library requires Go 1.20 or newer; add it to your go.mod with:
```shell
go get github.com/igorskyflyer/go-adblock-filter-counter@latest
```and import it like
```go
...import (
abcounter "github.com/igorskyflyer/go-adblock-filter-counter"
)...
```
## ๐คน๐ผ Examples
### `CountRules(source string) int`
```go
source string = `
[Adblock Plus 2.0]
||hello.world^
||hello.world^
||hello.world^
! Comment
||another.test^
`abcounter.CountRules(source) // returns 4
```
### `CountFileRules(filename string) (int, error)`
```go
filePath string = "./data/AdVoid.Core.txt"abcounter.CountFileRules(filePath) // returns (2495, nil)
```