Immutable.js 使用教程

Immutable.js 使用教程

immutable-jsImmutable persistent data collections for Javascript which increase efficiency and simplicity.项目地址:https://gitcode.com/gh_mirrors/im/immutable-js

1. 项目的目录结构及介绍

Immutable.js 的 GitHub 仓库结构如下:

immutable-js/
├── dist/
├── docs/
├── src/
├── test/
├── .gitignore
├── .npmignore
├── .travis.yml
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── package.json
└── yarn.lock
  • dist/: 包含编译后的 JavaScript 文件。
  • docs/: 包含项目的文档文件。
  • src/: 包含项目的源代码。
  • test/: 包含项目的测试代码。
  • .gitignore: Git 忽略文件配置。
  • .npmignore: npm 忽略文件配置。
  • .travis.yml: Travis CI 配置文件。
  • CONTRIBUTING.md: 贡献指南。
  • LICENSE: 项目许可证。
  • README.md: 项目说明文档。
  • package.json: 项目依赖和脚本配置。
  • yarn.lock: Yarn 锁定文件。

2. 项目的启动文件介绍

Immutable.js 没有传统意义上的“启动文件”,因为它是一个库,主要通过 npm 或 yarn 安装后在其他项目中使用。你可以通过以下方式引入 Immutable.js:

const { Map } = require('immutable');
const map1 = Map({ a: 1, b: 2, c: 3 });
const map2 = map1.set('b', 50);
console.log(map1.get('b'), map2.get('b')); // 2 50

3. 项目的配置文件介绍

Immutable.js 的配置文件主要是 package.json,其中包含了项目的依赖、脚本和其他元数据。以下是 package.json 的部分内容:

{
  "name": "immutable",
  "version": "4.0.0-rc.12",
  "description": "Immutable persistent data collections for Javascript which increase efficiency and simplicity.",
  "main": "dist/immutable.js",
  "module": "dist/immutable.es.js",
  "unpkg": "dist/immutable.min.js",
  "jsdelivr": "dist/immutable.min.js",
  "typings": "dist/immutable.d.ts",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/immutable-js/immutable-js.git"
  },
  "keywords": [
    "immutable",
    "persistent",
    "lazy",
    "data",
    "datastructure",
    "collection",
    "functional",
    "structure",
    "stateless",
    "sequence",
    "iteration"
  ],
  "author": "Lee Byron",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/immutable-js/immutable-js/issues"
  },
  "homepage": "https://github.com/immutable-js/immutable-js#readme",
  "scripts": {
    "build": "rollup -c",
    "test": "jest",
    "lint": "eslint src",
    "prepublishOnly": "yarn run build"
  },
  "dependencies": {},
  "devDependencies": {
    "@babel/core": "^7.0.0",
    "@babel/preset-env": "^7.0.0",
    "eslint": "^5.0.0",
    "jest": "^23.0.0",
    "rollup": "^0.60.0",
    "rollup-plugin-babel": "^4.0.0",
    "rollup-plugin-node-resolve": "^3.0.0"
  }
}
  • name: 项目名称。
  • version: 项目版本。
  • description: 项目描述。
  • main: 主入口文件。
  • module: ES 模块入口文件。
  • typings: TypeScript 类型定义文件。
  • scripts: 脚本命令。
  • dependencies: 项目依赖。
  • devDependencies: 开发依赖。

以上是 Immutable.js

immutable-jsImmutable persistent data collections for Javascript which increase efficiency and simplicity.项目地址:https://gitcode.com/gh_mirrors/im/immutable-js

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

仰北帅Bobbie

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值