Skip to content

ricokahler/jsonmatch-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSONMatch JS

The following code was compiled from go-jsonmatch using gopherjs 1.17

Note: this package is was created primarily for use with
👉 jsonmatch-patch 👈

Disclaimer: the bundle is huge. A pure JS implementation would be much much better.

The following entry point was used:

package main

import "github.com/gopherjs/gopherjs/js"
import "github.com/sanity-io/go-jsonmatch"

func MatchWrapper(path string, data interface{}, set interface{}) interface{}  {
	match, err1 := jsonmatch.Match(path, data)
	if (err1 != nil) {
		return nil
	}
	result, err2 := match.Set(set)
	if (err2 != nil) {
		return nil
	}
	return result
}


func main() {
	js.Module.Set("exports", map[string]interface{}{
		"JSONMatch": MatchWrapper,
	})
}

About

go-jsonmatch compiled to JS via GopherJS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published