CopyValues returns a Values that is a copy of the values from a Valuer, or an error if there are no values, or if one of the copied values is a NaN or Infinity.
(vs Valuer)
| 89 | // from a Valuer, or an error if there are no values, or if one of |
| 90 | // the copied values is a NaN or Infinity. |
| 91 | func CopyValues(vs Valuer) (Values, error) { |
| 92 | if vs.Len() == 0 { |
| 93 | return nil, ErrNoData |
| 94 | } |
| 95 | cpy := make(Values, vs.Len()) |
| 96 | for i := range vs.Len() { |
| 97 | cpy[i] = vs.Value(i) |
| 98 | if err := CheckFloats(cpy[i]); err != nil { |
| 99 | return nil, err |
| 100 | } |
| 101 | } |
| 102 | return cpy, nil |
| 103 | } |
| 104 | |
| 105 | func (vs Values) Len() int { |
| 106 | return len(vs) |
no test coverage detected