(s string)
| 1332 | } |
| 1333 | |
| 1334 | func (j jsonObject) RemoveString(s string) (JSON, bool, error) { |
| 1335 | idx, ok := findPairIndexByKey(j, s) |
| 1336 | if !ok { |
| 1337 | return j, false, nil |
| 1338 | } |
| 1339 | |
| 1340 | newVal := make([]jsonKeyValuePair, len(j)-1) |
| 1341 | for i, elem := range j[:idx] { |
| 1342 | newVal[i] = elem |
| 1343 | } |
| 1344 | for i, elem := range j[idx+1:] { |
| 1345 | newVal[idx+i] = elem |
| 1346 | } |
| 1347 | return jsonObject(newVal), true, nil |
| 1348 | } |
| 1349 | |
| 1350 | func (jsonNull) RemoveString(string) (JSON, bool, error) { return nil, false, errCannotDeleteFromScalar } |
| 1351 | func (jsonTrue) RemoveString(string) (JSON, bool, error) { return nil, false, errCannotDeleteFromScalar } |
no test coverage detected