| 2458 | } |
| 2459 | |
| 2460 | func (j jsonArray) RemoveIndex(idx int) (JSON, bool, error) { |
| 2461 | if idx < 0 { |
| 2462 | idx = len(j) + idx |
| 2463 | } |
| 2464 | if idx < 0 || idx >= len(j) { |
| 2465 | return j, false, nil |
| 2466 | } |
| 2467 | result := make(jsonArray, len(j)-1) |
| 2468 | for i := 0; i < idx; i++ { |
| 2469 | result[i] = j[i] |
| 2470 | } |
| 2471 | for i := idx + 1; i < len(j); i++ { |
| 2472 | result[i-1] = j[i] |
| 2473 | } |
| 2474 | return result, true, nil |
| 2475 | } |
| 2476 | |
| 2477 | func (j jsonObject) RemoveIndex(int) (JSON, bool, error) { |
| 2478 | return nil, false, errCannotDeleteFromObject |