Table of Contents
文档待完善
-
全局安装 babel-node 命令:
npm install babel-cli -g
-
项目内安装babel预设环境:
npm install babel-preset-env -D
-
使用 babel-node 代替 node:
node src/cors.js
→babel-node --presets env src/cors.js
-
参数
--presets env
可使用配置文件 .babelrc 存储
{ noChunkHash: false,
contentHashType: 'javascript',
chunk:
Chunk {
id: 2,
ids: [Array],
debugId: 1001,
name: 'PropertyPath',
preventIntegration: false,
entryModule: [NormalModule],
_modules: [SortableSet],
filenameTemplate: undefined,
_groups: [SortableSet],
files: [],
rendered: false,
hash: '455d3207fbfe2eaa2be68329f6048129',
contentHash: [Object],
renderedHash: '455d3207fbfe2eaa2be6',
chunkReason: undefined,
extraAsync: false,
removedModules: undefined },
hash: 'b0a04b840b2fdf82db58' }
}
arguments: [Arguments] { '0': '/Users/xiayx/Documents/Projects/js-util', '1': './src/core.js', '2': [Function] } arguments: [Arguments] { '0': '/Users/xiayx/Documents/Projects/js-util', '1': './src/property-path.js', '2': [Function] } arguments: [Arguments] { '0': '/Users/xiayx/Documents/Projects/js-util', '1': './src/object.js', '2': [Function] } arguments: [Arguments] { '0': '/Users/xiayx/Documents/Projects/js-util/src', '1': './core', '2': [Function] } arguments: [Arguments] { '0': '/Users/xiayx/Documents/Projects/js-util/src', '1': './property-path', '2': [Function] }
嵌套对象中从根属性到叶子属性组成的路径。
例如:
let demo = {
undefined: undefined,
null: null,
boolean: true,
number: 1,
string: "string",
function: function () {},
array: [1, 'string', {name: 'hi array'}],
object: {name: 'hi object'},
date: new Date(),
}
-
array[3].name : 'hi array'
-
object.name : 'hi object'