<commit_before>package js

import (
	"fmt"
	"strings"

	"github.com/cihangir/gene/generators/common"
)

// Generator for js client
type Generator struct{}

func pathfunc(data *common.TemplateData) string {
	return fmt.Sprintf(
		"%s/%s/%s.js",
		data.Settings.Get("fullPathPrefix").(string),
		data.ModuleName,
		strings.ToLower(data.Schema.Title),
	)

}

// Generate generates JS client for given schema
func (g *Generator) Generate(req *common.Req, res *common.Res) error {
	o := &common.Op{
		Name:        "js",
		Template:    FunctionsTemplate,
		PathFunc:    pathfunc,
		DoNotFormat: true,
	}

	return common.Proces(o, req, res)
}<commit_msg>gene/js: add js validator generator function into template functions<commit_after>package js

import (
	"fmt"
	"strings"

	"github.com/cihangir/gene/generators/common"
)

// Generator for js client
type Generator struct{}

func pathfunc(data *common.TemplateData) string {
	return fmt.Sprintf(
		"%s/%s/%s.js",
		data.Settings.Get("fullPathPrefix").(string),
		data.ModuleName,
		strings.ToLower(data.Schema.Title),
	)

}

// Generate generates JS client for given schema
func (g *Generator) Generate(req *common.Req, res *common.Res) error {
	common.TemplateFuncs["GenerateJSValidator"] = GenerateJSValidator

	o := &common.Op{
		Name:        "js",
		Template:    FunctionsTemplate,
		PathFunc:    pathfunc,
		DoNotFormat: true,
	}

	return common.Proces(o, req, res)
}
{'fraction_non_alphanumeric': 0.1340860973888497, 'fraction_numerical': 0.0, 'mean_word_length': 4.100719424460432, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5131242', 'n_tokens_mistral': 507, 'n_tokens_neox': 481, 'n_words': 114}