
Security News
Risky Biz Podcast: Making Reachability Analysis Work in Real-World Codebases
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
mygithub.libinneed.workers.dev/reclaimprotocol/jsonpathplus-go
π Perfect JavaScript Compatibility Achieved! - A high-performance Go implementation of JSONPath with 100% JSONPath-Plus JavaScript compatibility and string character position tracking.
go get github.com/reclaimprotocol/jsonpathplus-go
package main
import (
"fmt"
jp "github.com/reclaimprotocol/jsonpathplus-go"
)
func main() {
jsonStr := `{"users":[{"name":"Alice","age":30},{"name":"Bob","age":25}]}`
// Query with character position tracking
results, err := jp.Query("$.users[*].name", jsonStr)
if err != nil {
panic(err)
}
for _, result := range results {
fmt.Printf("Value: %v, Position: %d, Length: %d\n",
result.Value, result.OriginalIndex, result.Length)
}
}
This library achieves perfect 100% compatibility with JSONPath-Plus JavaScript library:
Category | Tests | Status |
---|---|---|
Basic Operations | 1/1 | β 100% |
Recursive Descent | 4/4 | β 100% |
Array Access | 3/3 | β 100% |
Filters | 2/2 | β 100% |
Property Filters | 7/7 | β 100% |
Parent Filters | 3/3 | β 100% |
Logical Filters | 3/3 | β 100% |
Value Filters | 5/5 | β 100% |
Edge Cases | 9/9 | β 100% |
Function Filters | 2/2 | β 100% |
TOTAL | 50/50 | β 100% |
Run compatibility tests: cd tests && node compare.js
βββ README.md # Main documentation
βββ go.mod # Go module configuration
βββ *.go # Core library source code
βββ cmd/ # Command line tools and examples
β βββ basic/ # Basic usage examples
β βββ production/ # Production setup examples
β βββ showcase/ # Feature demonstration
βββ tests/ # All test files
β βββ *_test.go # Unit tests
β βββ benchmarks/ # Performance benchmarks
βββ docs/ # Documentation
β βββ README.md # Detailed docs
β βββ *.md # Additional documentation
βββ .github/ # CI/CD configuration
βββ workflows/ci.yml # GitHub Actions
engine, err := jp.NewEngine(jp.DefaultConfig())
if err != nil {
log.Fatal(err)
}
defer engine.Close()
// Thread-safe queries with timeout
results, err := engine.QueryData("$.store.book[*]", data)
jsonStr := `{"id": 123, "name": "test"}`
results, err := jp.Query("$.name", jsonStr)
// Result contains:
// - Value: "test"
// - OriginalIndex: 15 (character position of "name" key)
// - Length: 6 (length of "name" in JSON)
// - Path: "$.name"
BenchmarkSimplePath-12 1,676,084 ops 718.9 ns/op 1544 B/op 24 allocs/op
BenchmarkRecursivePath-12 645,528 ops 2,104.0 ns/op 2492 B/op 36 allocs/op
BenchmarkFilterExpression-12 3,939 ops 311,978.0 ns/op 647197 B/op 5429 allocs/op
BenchmarkEngineQuery-12 2,373 ops 504,600.0 ns/op 721585 B/op 5668 allocs/op
BenchmarkStringIndexPreservation-12 339,159 ops 3,450.0 ns/op 5611 B/op 85 allocs/op
cd tests && node compare.js # Run comprehensive JavaScript compatibility tests
go test -v ./... # Run Go unit tests
go test -bench=. ./... # Run benchmarks
go test -race ./... # Race condition testing
The main compatibility test (tests/compare.js
) runs 50 comprehensive test cases comparing Go and JavaScript implementations:
See cmd/
directory for comprehensive examples:
cmd/basic/
- Basic JSONPath operationscmd/production/
- Production configurationcmd/showcase/
- Advanced features demogit checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)This project is licensed under the MIT License - see the LICENSE file for details.
β‘ Generated with Claude Code
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
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socketβs AI scanner detected the supply chain attack and flagged the malware.
Security News
CISAβs 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.