We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 352237b + e7396da commit f91a334Copy full SHA for f91a334
1 file changed
list.go
@@ -191,6 +191,11 @@ func (p *Value) Set(v obj) {
191
p.data = fromObj(v)
192
}
193
194
+// NewValue creates a new Value initialized with the given object.
195
+func NewValue(o obj) Value {
196
+ return Value{data: fromObj(o)}
197
+}
198
+
199
// -------------------------------------------------------------------------------------
200
201
type List struct {
@@ -328,3 +333,12 @@ func (p *List) IndexOf(v obj) Pos {
328
333
func (p *List) Clear() {
329
334
p.data = p.data[:0]
330
335
336
337
+// NewList creates a new List initialized with the given elements.
338
+func NewList(l ...obj) List {
339
+ data := make([]obj, len(l))
340
+ for i, v := range l {
341
+ data[i] = fromObj(v)
342
+ }
343
+ return List{data: data}
344
0 commit comments