// See: http://duktape.org/api.html#duk_to_object
976087
func (d *Context) ToObject(index int) {
	C.duk_to_object(d.duk_context, C.duk_idx_t(index))
}
38819
func (d *Context) PutProp(objIndex int) bool {
	return int(C.duk_put_prop(d.duk_context, C.duk_idx_t(objIndex))) == 1
}
1080489
func (l *SESTemplateTemplateList) UnmarshalJSON(buf []byte) error {
	// Cloudformation allows a single object when a list of objects is expected
	item := SESTemplateTemplate{}
	if err := json.Unmarshal(buf, &item); err == nil {
		*l = SESTemplateTemplateList{item}
		return nil
	}
	list := []SESTemplateTemplate{}
	err := json.Unmarshal(buf, &list)
	if err == nil {
		*l = SESTemplateTemplateList(list)
		return nil
	}
	return err
}
396299
func ConvertToPod(obj interface{}) interface{} {
	pod, ok := obj.(*v1.Pod)
	if !ok {
		return nil
	}
	p := &types.Pod{
		TypeMeta:        pod.TypeMeta,
		ObjectMeta:      pod.ObjectMeta,
		StatusPodIP:     pod.Status.PodIP,
		StatusHostIP:    pod.Status.HostIP,
		SpecHostNetwork: pod.Spec.HostNetwork,
	}
	*pod = v1.Pod{}
	return p
}
60384
func (l *BudgetsBudgetSpendList) UnmarshalJSON(buf []byte) error {
	// Cloudformation allows a single object when a list of objects is expected
	item := BudgetsBudgetSpend{}
	if err := json.Unmarshal(buf, &item); err == nil {
		*l = BudgetsBudgetSpendList{item}
		return nil
	}
	list := []BudgetsBudgetSpend{}
	err := json.Unmarshal(buf, &list)
	if err == nil {
		*l = BudgetsBudgetSpendList(list)
		return nil
	}
	return err
}
244742
func (d *Context) GetProp(objIndex int) bool {
	return int(C.duk_get_prop(d.duk_context, C.duk_idx_t(objIndex))) == 1
}
1295479
func (s *dupSkipper) Dup(v string) bool {
	if s.m == nil {
		s.m = make(map[string]bool)
	}
	if s.m[v] {
		return true
	}
	s.m[v] = true
	return false
}
965768
func (c *Converter) Convert(ctx context.Context, opts ...ConvertOpt) (ocispec.Descriptor, error) {
	co := ConvertOptions{
		ManifestMediaType: ocispec.MediaTypeImageManifest,
		ConfigMediaType:   ocispec.MediaTypeImageConfig,
	}
	for _, opt := range opts {
		if err := opt(ctx, &co); err != nil {
			return ocispec.Descriptor{}, err
		}
	}

	history, diffIDs, err := c.schema1ManifestHistory()
	if err != nil {
		return ocispec.Descriptor{}, errors.Wrap(err, "schema 1 conversion failed")
	}

	var img ocispec.Image
	if err := json.Unmarshal([]byte(c.pulledManifest.History[0].V1Compatibility), &img); err != nil {
		return ocispec.Descriptor{}, errors.Wrap(err, "failed to unmarshal image from schema 1 history")
	}

	img.History = history
	img.RootFS = ocispec.RootFS{
		Type:    "layers",
		DiffIDs: diffIDs,
	}

	b, err := json.MarshalIndent(img, "", "   ")
	if err != nil {
		return ocispec.Descriptor{}, errors.Wrap(err, "failed to marshal image")
	}

	config := ocispec.Descriptor{
		MediaType: co.ConfigMediaType,
		Digest:    digest.Canonical.FromBytes(b),
		Size:      int64(len(b)),
	}

	layers := make([]ocispec.Descriptor, len(diffIDs))
	for i, diffID := range diffIDs {
		layers[i] = c.layerBlobs[diffID]
	}

	manifest := ocispec.Manifest{
		Versioned: specs.Versioned{
			SchemaVersion: 2,
		},
		Config: config,
		Layers: layers,
	}

	mb, err := json.MarshalIndent(manifest, "", "   ")
	if err != nil {
		return ocispec.Descriptor{}, errors.Wrap(err, "failed to marshal image")
	}

	desc := ocispec.Descriptor{
		MediaType: co.ManifestMediaType,
		Digest:    digest.Canonical.FromBytes(mb),
		Size:      int64(len(mb)),
	}

	labels := map[string]string{}
	labels["containerd.io/gc.ref.content.0"] = manifest.Config.Digest.String()
	for i, ch := range manifest.Layers {
		labels[fmt.Sprintf("containerd.io/gc.ref.content.%d", i+1)] = ch.Digest.String()
	}

	ref := remotes.MakeRefKey(ctx, desc)
	if err := content.WriteBlob(ctx, c.contentStore, ref, bytes.NewReader(mb), desc, content.WithLabels(labels)); err != nil {
		return ocispec.Descriptor{}, errors.Wrap(err, "failed to write config")
	}

	ref = remotes.MakeRefKey(ctx, config)
	if err := content.WriteBlob(ctx, c.contentStore, ref, bytes.NewReader(b), config); err != nil {
		return ocispec.Descriptor{}, errors.Wrap(err, "failed to write config")
	}

	return desc, nil
}
785323
func applyPatchToObject(
	defaulter runtime.ObjectDefaulter,
	originalMap map[string]interface{},
	patchMap map[string]interface{},
	objToUpdate runtime.Object,
	schemaReferenceObj runtime.Object,
) error {
	patchedObjMap, err := strategicpatch.StrategicMergeMapPatch(originalMap, patchMap, schemaReferenceObj)
	if err != nil {
		return interpretStrategicMergePatchError(err)
	}

	// Rather than serialize the patched map to JSON, then decode it to an object, we go directly from a map to an object
	if err := runtime.DefaultUnstructuredConverter.FromUnstructured(patchedObjMap, objToUpdate); err != nil {
		return err
	}
	// Decoding from JSON to a versioned object would apply defaults, so we do the same here
	defaulter.Default(objToUpdate)

	return nil
}
658140
func (p PvtUpdateBatch) ToCompositeKeyMap() PvtdataCompositeKeyMap {
	m := make(PvtdataCompositeKeyMap)
	for ns, nsBatch := range p.UpdateMap {
		for _, coll := range nsBatch.GetCollectionNames() {
			for key, vv := range nsBatch.GetUpdates(coll) {
				m[PvtdataCompositeKey{ns, coll, key}] = vv
			}
		}
	}
	return m
}
1046590
func DOMObjectToList(o *js.Object) []*js.Object {
	var out []*js.Object
	length := o.Get("length").Int()
	for i := 0; i < length; i++ {
		out = append(out, o.Call("item", i))
	}
	return out
}
1208029
func (orig *SampleFJSON) Convert() (*SampleF, error) {
	ret := &SampleF{}

	b := NewSampleFJSONBuilder().AddAll()
	for _, info := range b._properties {
		if err := info.Decoder(orig, ret); err != nil {
			return nil, err
		}
	}

	return ret, nil
}
153975
func (s Set) Dup() Set {
	ret := make(Set, len(s))
	for k := range s {
		ret[k] = struct{}{}
	}
	return ret
}
727101
func objectToCell(o *triple.Object) (*table.Cell, error) {
	c := &table.Cell{}
	if n, err := o.Node(); err == nil {
		c.N = n
		return c, nil
	}
	if p, err := o.Predicate(); err == nil {
		c.P = p
		return c, nil
	}
	if l, err := o.Literal(); err == nil {
		c.L = l
		return c, nil
	}
	return nil, fmt.Errorf("unknown object type in object %q", o)
}
1362799
func (l *WAFRulePredicateList) UnmarshalJSON(buf []byte) error {
	// Cloudformation allows a single object when a list of objects is expected
	item := WAFRulePredicate{}
	if err := json.Unmarshal(buf, &item); err == nil {
		*l = WAFRulePredicateList{item}
		return nil
	}
	list := []WAFRulePredicate{}
	err := json.Unmarshal(buf, &list)
	if err == nil {
		*l = WAFRulePredicateList(list)
		return nil
	}
	return err
}
1141721
func (d *Context) ToInt(index int) int {
	return int(C.duk_to_int(d.duk_context, C.duk_idx_t(index)))
}
269699
func (c *unstructuredConverter) ToUnstructured(obj interface{}) (map[string]interface{}, error) {
	var u map[string]interface{}
	var err error
	if unstr, ok := obj.(Unstructured); ok {
		u = unstr.UnstructuredContent()
	} else {
		t := reflect.TypeOf(obj)
		value := reflect.ValueOf(obj)
		if t.Kind() != reflect.Ptr || value.IsNil() {
			return nil, fmt.Errorf("ToUnstructured requires a non-nil pointer to an object, got %v", t)
		}
		u = map[string]interface{}{}
		err = toUnstructured(value.Elem(), reflect.ValueOf(&u).Elem())
	}
	if c.mismatchDetection {
		newUnstr := map[string]interface{}{}
		newErr := toUnstructuredViaJSON(obj, &newUnstr)
		if (err != nil) != (newErr != nil) {
			klog.Fatalf("ToUnstructured unexpected error for %v: error: %v; newErr: %v", obj, err, newErr)
		}
		if err == nil && !c.comparison.DeepEqual(u, newUnstr) {
			klog.Fatalf("ToUnstructured mismatch\nobj1: %#v\nobj2: %#v", u, newUnstr)
		}
	}
	if err != nil {
		return nil, err
	}
	return u, nil
}