X-Git-Url: https://git.josue.xyz/?p=dotfiles%2F.git;a=blobdiff_plain;f=.config%2Fcoc%2Fextensions%2Fnode_modules%2Fcoc-prettier%2Fnode_modules%2Fyallist%2Fyallist.js;h=4e83ab1c542a5130d551cfa506409c95bf2d4a36;hp=518d23330b936c0b1b370d9304ae48b0fccf2297;hb=4d07c77cf4d78cab8639e13ddc3c22495e585b0b;hpb=b3950616b54221c40a7dab9099bda675007e5b6e diff --git a/.config/coc/extensions/node_modules/coc-prettier/node_modules/yallist/yallist.js b/.config/coc/extensions/node_modules/coc-prettier/node_modules/yallist/yallist.js index 518d2333..4e83ab1c 100644 --- a/.config/coc/extensions/node_modules/coc-prettier/node_modules/yallist/yallist.js +++ b/.config/coc/extensions/node_modules/coc-prettier/node_modules/yallist/yallist.js @@ -1,3 +1,4 @@ +'use strict' module.exports = Yallist Yallist.Node = Node @@ -53,6 +54,8 @@ Yallist.prototype.removeNode = function (node) { node.next = null node.prev = null node.list = null + + return next } Yallist.prototype.unshiftNode = function (node) { @@ -317,6 +320,37 @@ Yallist.prototype.sliceReverse = function (from, to) { return ret } +Yallist.prototype.splice = function (start, deleteCount, ...nodes) { + if (start > this.length) { + start = this.length - 1 + } + if (start < 0) { + start = this.length + start; + } + + for (var i = 0, walker = this.head; walker !== null && i < start; i++) { + walker = walker.next + } + + var ret = [] + for (var i = 0; walker && i < deleteCount; i++) { + ret.push(walker.value) + walker = this.removeNode(walker) + } + if (walker === null) { + walker = this.tail + } + + if (walker !== this.head && walker !== this.tail) { + walker = walker.prev + } + + for (var i = 0; i < nodes.length; i++) { + walker = insert(this, walker, nodes[i]) + } + return ret; +} + Yallist.prototype.reverse = function () { var head = this.head var tail = this.tail @@ -330,6 +364,23 @@ Yallist.prototype.reverse = function () { return this } +function insert (self, node, value) { + var inserted = node === self.head ? + new Node(value, null, node, self) : + new Node(value, node, node.next, self) + + if (inserted.next === null) { + self.tail = inserted + } + if (inserted.prev === null) { + self.head = inserted + } + + self.length++ + + return inserted +} + function push (self, item) { self.tail = new Node(item, self.tail, null, self) if (!self.head) { @@ -368,3 +419,8 @@ function Node (value, prev, next, list) { this.next = null } } + +try { + // add if support for Symbol.iterator is present + require('./iterator.js')(Yallist) +} catch (er) {}