(idAccessor, extendsIdAccessor)
| 14541 | return str.split(needle).join("") |
| 14542 | } |
| 14543 | static _makeGraphSortFunction(idAccessor, extendsIdAccessor) { |
| 14544 | return (particleA, particleB) => { |
| 14545 | // -1 === a before b |
| 14546 | const particleAUniqueId = idAccessor(particleA) |
| 14547 | const particleAExtends = extendsIdAccessor(particleA) |
| 14548 | const particleBUniqueId = idAccessor(particleB) |
| 14549 | const particleBExtends = extendsIdAccessor(particleB) |
| 14550 | const particleAExtendsParticleB = particleAExtends === particleBUniqueId |
| 14551 | const particleBExtendsParticleA = particleBExtends === particleAUniqueId |
| 14552 | const particleAFirst = -1 |
| 14553 | const particleBFirst = 1 |
| 14554 | if (!particleAExtends && !particleBExtends) { |
| 14555 | // If neither extends, sort by cue |
| 14556 | if (particleAUniqueId > particleBUniqueId) return particleBFirst |
| 14557 | else if (particleAUniqueId < particleBUniqueId) return particleAFirst |
| 14558 | return 0 |
| 14559 | } |
| 14560 | // If only one extends, the other comes first |
| 14561 | else if (!particleAExtends) return particleAFirst |
| 14562 | else if (!particleBExtends) return particleBFirst |
| 14563 | // If A extends B, B should come first |
| 14564 | if (particleAExtendsParticleB) return particleBFirst |
| 14565 | else if (particleBExtendsParticleA) return particleAFirst |
| 14566 | // Sort by what they extend |
| 14567 | if (particleAExtends > particleBExtends) return particleBFirst |
| 14568 | else if (particleAExtends < particleBExtends) return particleAFirst |
| 14569 | // Finally sort by cue |
| 14570 | if (particleAUniqueId > particleBUniqueId) return particleBFirst |
| 14571 | else if (particleAUniqueId < particleBUniqueId) return particleAFirst |
| 14572 | // Should never hit this, unless we have a duplicate line. |
| 14573 | return 0 |
| 14574 | } |
| 14575 | } |
| 14576 | } |
| 14577 | Utils.Timer = Timer |
| 14578 | //http://stackoverflow.com/questions/37684/how-to-replace-plain-urls-with-links#21925491 |
nothing calls this directly
no outgoing calls
no test coverage detected