浏览代码

Add docs to getSingleValue().

Maciej Gołaszewski 5 年之前
父节点
当前提交
757af2efa4
共有 1 个文件被更改,包括 16 次插入0 次删除
  1. 16 0
      packages/ckeditor5-table/src/commands/utils.js

+ 16 - 0
packages/ckeditor5-table/src/commands/utils.js

@@ -58,6 +58,22 @@ export function createEmptyTableCell( writer, insertPosition, attributes = {} )
 	writer.insert( tableCell, insertPosition );
 }
 
+/**
+ * Returns a string if all four values of box edges are equal.
+ *
+ * If string is passed it is treated as a single value (pass-through).
+ *
+ *		// returns 'foo':
+ *		getSingleValue( { top: 'foo', right: 'foo', bottom: 'foo', left: 'foo' } );
+ *		getSingleValue( 'foo' );
+ *
+ *		// Returns undefined:
+ *		getSingleValue( { top: 'foo', right: 'foo', bottom: 'bar', left: 'foo' } );
+ *		getSingleValue( { top: 'foo', right: 'foo' } );
+ *
+ * @param objectOrString
+ * @returns {module:engine/view/stylesmap~BoxEdges|String}
+ */
 export function getSingleValue( objectOrString ) {
 	if ( !objectOrString || !isObject( objectOrString ) ) {
 		return objectOrString;