2
我有几个共享某个底层数据结构的函数,同时也做了非常不同的事情,例如抽象并不是一个好主意。我可以在JSDOC中使用变量
文档可能是这样的(虽然这只是一个小样本的许多方法只能分享一些这方面的文档):
/**
* Creates an array of objects, with each object containing the average distance that minute. The
* objects have the keys **Timestamp** (ms since epoch), **Year** (year in device local time) **Month** (
* month in device local time), **Day** (day in device local time), **Hour** (hour in device local time)
* **Season** (season in device local time, Northern Hemisphere), **Weekday** (Week day name in device
* local time), **WeekNum** (week number (1-53) in device local time), **Depth** (the average depth that
* minute), and **Vibration** (the magnitude of the maximum acceleration for the minute, in Gs).
* <snip>
*/
/**
* Creates an array of objects, with each object containing the data for one minute of temperature data
* from temperature probes. The objects have the keys **Timestamp** (ms since epoch), **Year** (year in
* device local time) **Month** (month in device local time), **Day** (day in device local time), **Hour**
* (hour in device local time) **Season** (season in device local time, Northern Hemisphere), **Weekday**
* (Week day name in device local time), **WeekNum** (week number (1-53) in device local time),
* **Temperature** (Temperature measured by the temperature probe), **Vib**(the standard deviation of the
* acceleration of the accelerometer, in Gs).
* <snip>
*/
你可以从样品,我震动的文档和它看手段不一致。每次我改变它的含义时(甚至更糟糕的是,硬件工程师改变它的含义),我不想在6处去修复这些文档。有没有办法让我有一个全球性的术语词典并根据需要插入它?就像:
terms.json
> {vibDef: "the magnitude of the maximum acceleration for the minute, in Gs"}
code.js
> /**
* Creates an array of objects, with each object containing the average distance that minute. The
* objects have the keys **Timestamp** (ms since epoch), **Year** (year in device local time) **Month** (
* month in device local time), **Day** (day in device local time), **Hour** (hour in device local time)
* **Season** (season in device local time, Northern Hemisphere), **Weekday** (Week day name in device
* local time), **WeekNum** (week number (1-53) in device local time), **Depth** (the average depth that
* minute), and **Vibration** (<<vibDef>>).
* <snip>
*/
这将插入我的定义vibDef无处不在文档字符串中找到它?
我最后一次使用jsdoc,你可以关联自己的解析器(我们把它用于降价),因此增加一个为你的词汇表标签应该是可能的? – ssube