@ricokahler/jsonmatch-js
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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,
	})
}

Readme

Keywords

Package Sidebar

Install

npm i @ricokahler/jsonmatch-js

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

2.01 MB

Total Files

5

Last publish

Collaborators

  • ricokahler