func Len() int {
	return defaultSerializers.Len()
}
Len returns the length of the serializers map
package serializer
import (
	"strings"
	"sync"
	"github.com/kataras/go-errors"
	"github.com/kataras/go-serializer/json"
	"github.com/kataras/go-serializer/jsonp"
	"github.com/kataras/go-serializer/markdown"
	"github.com/kataras/go-serializer/xml"
)
const (
	Version = "0.0.5"
)
type (
	Serializer interface {
		Serialize(interface{}, ...map[string]interface{}) ([]byte, error)
	}
	SerializeFunc func(interface{}, ...map[string]interface{}) ([]byte, error)
)
func (s SerializeFunc) Serialize(obj interface{}, options ...map[string]interface{}) ([]byte, error) {
	return s(obj, options...)
}
const NotAllowedKeyChar = '.'
type Serializers map[string][]Serializer
var defaultSerializers = Serializers{}
func For(key string, serializer ...Serializer) {
	defaultSerializers.For(key, serializer...)
}
func (s Serializers) For(key string, serializer ...Serializer) {
	if s == nil {
		s = make(map[string][]Serializer)
	}
	if strings.IndexByte(key, NotAllowedKeyChar) != -1 {
		return
	}
	if s[key] == nil {
		s[key] = make([]Serializer, 0)
	}
	s[key] = append(s[key], serializer...)
}
var (
	errKeyMissing         = errors.New("please specify a key")
	errSerializersEmpty   = errors.New("serializers map is empty")
	errSerializerNotFound = errors.New("serializer with key '%s' couldn't be found")
)
var (
	once                   sync.Once
	defaultSerializersKeys = [...]string{json.ContentType, jsonp.ContentType, xml.ContentType, markdown.ContentType}
)
func RegisterDefaults(serializers Serializers) {
	for _, ctype := range defaultSerializersKeys {
		if sers := serializers[ctype]; len(sers) == 0 {
			switch ctype {
			case json.ContentType:
				serializers.For(ctype, json.New())
			case jsonp.ContentType:
				serializers.For(ctype, jsonp.New())
			case xml.ContentType:
				serializers.For(ctype, xml.New())
			case markdown.ContentType:
				serializers.For(ctype, markdown.New())
			}
		}
	}
}
func Serialize(key string, obj interface{}, options ...map[string]interface{}) ([]byte, error) {
	once.Do(func() {
		RegisterDefaults(defaultSerializers)
	})
	return defaultSerializers.Serialize(key, obj, options...)
}
func (s Serializers) Serialize(key string, obj interface{}, options ...map[string]interface{}) ([]byte, error) {
	if key == "" {
		return nil, errKeyMissing
	}
	if s == nil {
		return nil, errSerializersEmpty
	}
	serializers := s[key]
	if serializers == nil {
		return nil, errSerializerNotFound.Format(key)
	}
	var finalResult []byte
	for i, n := 0, len(serializers); i < n; i++ {
		result, err := serializers[i].Serialize(obj, options...)
		if err != nil {
			return nil, err
		}
		finalResult = append(finalResult, result...)
	}
	return finalResult, nil
}
func SerializeToString(key string, obj interface{}, options ...map[string]interface{}) (string, error) {
	return defaultSerializers.SerializeToString(key, obj, options...)
}
func (s Serializers) SerializeToString(key string, obj interface{}, options ...map[string]interface{}) (string, error) {
	result, err := s.Serialize(key, obj, options...)
	if err != nil {
		return "", err
	}
	return string(result), nil
}