JSPM

linked-list-node

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q10629F
  • License ISC

Package Exports

  • linked-list-node
  • linked-list-node/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (linked-list-node) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

js 链表

// 第一步 安装依赖
npm install linked-list-node

import linkedList from 'linked-list-node';

// new 一个链表参数为第一个节点的数据
var linked = new linkedList(123)

// 获取链表
linked.data

// 获取下一个节点
linked.data.next

// 获取上一个节点
linked.data.previous

// 读取节点数据
linked.data.val
基础方法 参数 方法名字
linked.map 回调方法 遍历链表中的节点
linked.length 获取链表长度
查找方法 参数 方法名字
linked.find 节点值/函数 查找节点
linked.last 最后一个节点
linked.first 第一个节点

操作方法为链式函数。例如:linked.push(1).unshift(2)

操作方法 参数 方法名字
linked.push 节点值 向后追加节点
linked.unshift 节点值 向前追加节点
linked.insert 1,节点值/函数查找位置。2,在找到的位置后添加的节点值 插入节点
linked.del 节点值/函数 删除节点
linked.setVal 节点值/函数,替换值 修改节点值
linked.exchange 1,节点值/函数。2,节点值/函数 交换节点位置
linked.sort 函数:排序函数必须有返回值 true/false,true 为交换位置/false 为不变 节点排序