| 1445 | } |
| 1446 | |
| 1447 | func (j jsonArray) RemoveIndex(idx int) (JSON, bool, error) { |
| 1448 | if idx < 0 { |
| 1449 | idx = len(j) + idx |
| 1450 | } |
| 1451 | if idx < 0 || idx >= len(j) { |
| 1452 | return j, false, nil |
| 1453 | } |
| 1454 | result := make(jsonArray, len(j)-1) |
| 1455 | for i := 0; i < idx; i++ { |
| 1456 | result[i] = j[i] |
| 1457 | } |
| 1458 | for i := idx + 1; i < len(j); i++ { |
| 1459 | result[i-1] = j[i] |
| 1460 | } |
| 1461 | return result, true, nil |
| 1462 | } |
| 1463 | |
| 1464 | func (j jsonObject) RemoveIndex(int) (JSON, bool, error) { |
| 1465 | return nil, false, errCannotDeleteFromObject |