| 1360 | } |
| 1361 | |
| 1362 | func (j jsonArray) RemoveIndex(idx int) (JSON, bool, error) { |
| 1363 | if idx < 0 { |
| 1364 | idx = len(j) + idx |
| 1365 | } |
| 1366 | if idx < 0 || idx >= len(j) { |
| 1367 | return j, false, nil |
| 1368 | } |
| 1369 | result := make(jsonArray, len(j)-1) |
| 1370 | for i := 0; i < idx; i++ { |
| 1371 | result[i] = j[i] |
| 1372 | } |
| 1373 | for i := idx + 1; i < len(j); i++ { |
| 1374 | result[i-1] = j[i] |
| 1375 | } |
| 1376 | return result, true, nil |
| 1377 | } |
| 1378 | |
| 1379 | func (j jsonObject) RemoveIndex(int) (JSON, bool, error) { |
| 1380 | return nil, false, errCannotDeleteFromObject |