文档编写规范
为了方便使用者快速明白方法的用途,一个准确的文档是必不可少的,因此我们对文档的编写做了限制。
示例
文档示例
chunk
[dtc.]util.chunk(array, [size=1])
Creates an array of elements split into groups the length of size. If array can't be split evenly, the final chunk will be the remaining elements.
Arguments
array (Array)
: The array to process.
[size=1] (number)
: The length of each chunk
Returns
(Array)
: Returns the new array of chunks.
Example
[dtc.]util.chunk(['a', 'b', 'c', 'd'], 2);
// => [['a', 'b'], ['c', 'd']]
[dtc.]util.chunk(['a', 'b', 'c', 'd'], 3);
// => [['a', 'b', 'c'], ['d']]
文档格式
一分合格的文档至少包含6个部分
- 方法名
- 方法调用方式
- 方法的功能描述
- 参数说明
- 返回值说明
- 示例代码
如果是一个展示样式相关的方法,那么你可能需要引入一个codepen
的示例效果,更多在文档中引入codepen
的方法请访问Codepen支持。