// AddEmbeddedJSONOmitEmpty adds an EmbeddedJSON to be encoded or skips it if nil pointer or empty.
//
// It basically blindly writes the bytes to the final buffer. Therefore,
// it expects the JSON to be of proper format.
544231
func (enc *Encoder) AddEmbeddedJSONOmitEmpty(v *EmbeddedJSON) {
	if v == nil || len(*v) == 0 {
		return
	}
	r := enc.getPreviousRune()
	if r != '[' {
		enc.writeByte(',')
	}
	enc.writeBytes(*v)
}
291440
func WriteJSON(writer io.Writer, v interface{}, options JSON, enableOptimization ...bool) (int, error) {
	var (
		result   []byte
		err      error
		optimize = len(enableOptimization) > 0 && enableOptimization[0]
	)

	if indent := options.Indent; indent != "" {
		marshalIndent := json.MarshalIndent
		if optimize {
			marshalIndent = jsoniter.ConfigCompatibleWithStandardLibrary.MarshalIndent
		}

		result, err = marshalIndent(v, "", indent)
		result = append(result, newLineB...)
	} else {
		marshal := json.Marshal
		if optimize {
			marshal = jsoniter.ConfigCompatibleWithStandardLibrary.Marshal
		}

		result, err = marshal(v)
	}

	if err != nil {
		return 0, err
	}

	if options.UnescapeHTML {
		result = bytes.Replace(result, ltHex, lt, -1)
		result = bytes.Replace(result, gtHex, gt, -1)
		result = bytes.Replace(result, andHex, and, -1)
	}

	if prefix := options.Prefix; prefix != "" {
		result = append([]byte(prefix), result...)
	}

	return writer.Write(result)
}
734627
func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) {
	if h, ok := t.(tHelper); ok {
		h.Helper()
	}
	if assert.NotEmpty(t, object, msgAndArgs...) {
		return
	}
	t.FailNow()
}
234453
func (a *JSONAttachment) MarshalJSON() ([]byte, error) {
	type EmbeddedJSONAttachment JSONAttachment
	return json.Marshal(&struct {
		Duration float64 `json:"duration_in_seconds,omitempty"`
		*EmbeddedJSONAttachment
	}{
		EmbeddedJSONAttachment: (*EmbeddedJSONAttachment)(a),
		Duration:               a.Duration.Seconds(),
	})
}
451979
func NewAddInspectedHeapObjectArgs(heapObjectID HeapSnapshotObjectID) *AddInspectedHeapObjectArgs {
	args := new(AddInspectedHeapObjectArgs)
	args.HeapObjectID = heapObjectID
	return args
}
658505
func ValidateNotEmpty(value interface{}) error {
	if typeutil.IsEmpty(value) {
		return fmt.Errorf("expected non-empty value, got: %v", value)
	}

	return nil
}
250435
func (enc *Encoder) AddFloatKeyOmitEmpty(key string, v float64) {
	enc.Float64KeyOmitEmpty(key, v)
}
72348
func (enc *Encoder) AddInt64KeyNullEmpty(key string, v int64) {
	enc.Int64KeyNullEmpty(key, v)
}
256611
func (enc *Encoder) AddArrayKeyOmitEmpty(key string, v MarshalerJSONArray) {
	enc.ArrayKeyOmitEmpty(key, v)
}
472685
func (as *Assertion) ToBeEmpty() {
	if !as.isEmpty(as.Value) {
		as.Test.PrintError(fmt.Sprintf("Expected `%v` to be empty", as.Value))
	}
}
96727
func NotImplemented(w http.ResponseWriter, response interface{}) {
	Respond(w, http.StatusNotImplemented, response)
}
534196
func (enc *Encoder) AddInterfaceKeyOmitEmpty(key string, v interface{}) {
	switch vt := v.(type) {
	case string:
		enc.AddStringKeyOmitEmpty(key, vt)
	case bool:
		enc.AddBoolKeyOmitEmpty(key, vt)
	case MarshalerJSONArray:
		enc.AddArrayKeyOmitEmpty(key, vt)
	case MarshalerJSONObject:
		enc.AddObjectKeyOmitEmpty(key, vt)
	case int:
		enc.AddIntKeyOmitEmpty(key, vt)
	case int64:
		enc.AddIntKeyOmitEmpty(key, int(vt))
	case int32:
		enc.AddIntKeyOmitEmpty(key, int(vt))
	case int16:
		enc.AddIntKeyOmitEmpty(key, int(vt))
	case int8:
		enc.AddIntKeyOmitEmpty(key, int(vt))
	case uint64:
		enc.AddIntKeyOmitEmpty(key, int(vt))
	case uint32:
		enc.AddIntKeyOmitEmpty(key, int(vt))
	case uint16:
		enc.AddIntKeyOmitEmpty(key, int(vt))
	case uint8:
		enc.AddIntKeyOmitEmpty(key, int(vt))
	case float64:
		enc.AddFloatKeyOmitEmpty(key, vt)
	case float32:
		enc.AddFloat32KeyOmitEmpty(key, vt)
	default:
		if vt != nil {
			enc.err = InvalidMarshalError(fmt.Sprintf(invalidMarshalErrorMsg, vt))
			return
		}
		return
	}
}
280041
func (w *whitelistRegistry) writeJSON(path string, app AppManifest) error {
	// Write the file
	fp, err := os.OpenFile(path, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0644)
	if err != nil {
		return err
	}
	defer fp.Close()

	encoder := json.NewEncoder(fp)
	encoder.SetIndent("", "    ")
	if err := encoder.Encode(&app); err != nil {
		return err
	}

	return fp.Sync()
}
304849
func NotImplemented(message string, args ...interface{}) error {
	return WrapWithMessage(&NotImplementedError{
		Message: fmt.Sprintf(message, args...),
	}, message, args...)
}
890670
func (enc *Encoder) BoolKeyOmitEmpty(key string, v bool) {
	if enc.hasKeys {
		if !enc.keyExists(key) {
			return
		}
	}
	if v == false {
		return
	}
	enc.grow(5 + len(key))
	r := enc.getPreviousRune()
	if r != '{' {
		enc.writeByte(',')
	}
	enc.writeByte('"')
	enc.writeStringEscape(key)
	enc.writeBytes(objKey)
	enc.buf = strconv.AppendBool(enc.buf, v)
}
450664
func ConfigModelFromJSONBytes(configBytes []byte) (bitriseData models.BitriseDataModel, warnings []string, err error) {
	if err = json.Unmarshal(configBytes, &bitriseData); err != nil {
		return
	}
	warnings, err = normalizeValidateFillMissingDefaults(&bitriseData)
	if err != nil {
		return
	}

	return
}
288670
func (enc *Encoder) AddIntKeyOmitEmpty(key string, v int) {
	enc.IntKeyOmitEmpty(key, v)
}