MCPcopy Create free account
hub / github.com/microsoft/SandDance / insertNode

Function insertNode

docs/tests/v2/es6/js/sanddance.js:69886–69900  ·  view source on GitHub ↗
(i, x, y, last)

Source from the content-addressed store, hash-verified

69884
69885// create a node and optionally link it with previous one (in a circular doubly linked list)
69886function insertNode(i, x, y, last) {
69887 var p = new Node(i, x, y);
69888
69889 if (!last) {
69890 p.prev = p;
69891 p.next = p;
69892
69893 } else {
69894 p.next = last.next;
69895 p.prev = last;
69896 last.next.prev = p;
69897 last.next = p;
69898 }
69899 return p;
69900}
69901
69902function removeNode(p) {
69903 p.next.prev = p.prev;

Callers 1

linkedListFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected