()
| 440 | |
| 441 | const secondary = this.getKeyByName(name); |
| 442 | if (secondary === undefined) { |
| 443 | throw `Table, secondary key "${name}" not found`; |
| 444 | } |
| 445 | const copy = secondaryDuplicatesFirst([...this.value], secondary); |
| 446 | sort(copy as any, {by: secondary.keyFields.map(k => {return {component: k.toLowerCase()};}), skipSortedCheck: true}); |
| 447 | |
| 448 | this.secondaryIndexes[name.trimEnd().toUpperCase()] = copy; |
| 449 | return copy; |
| 450 | } |
| 451 |