1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-13 02:34:05 +02:00

rename kind to object for clarity (#1501)

* rename `kind` to `object` for clarity

* add deprecation warning for direct access

* add deprecation warning for node creation
This commit is contained in:
Ian Storm Taylor
2018-01-04 15:26:53 -08:00
committed by GitHub
parent a6c56a2c56
commit 5444a300b8
144 changed files with 842 additions and 820 deletions

View File

@@ -270,15 +270,15 @@ function resolveCreators(options) {
}
/**
* Normalize a node creator with `key` and `value`, of `kind`.
* Normalize a node creator with `key` and `value`, of `object`.
*
* @param {String} key
* @param {Function|Object|String} value
* @param {String} kind
* @param {String} object
* @return {Function}
*/
function normalizeNode(key, value, kind) {
function normalizeNode(key, value, object) {
if (typeof value == 'function') {
return value
}
@@ -292,7 +292,7 @@ function normalizeNode(key, value, kind) {
const { key: attrKey, ...rest } = attributes
const attrs = {
...value,
kind,
object,
key: attrKey,
data: {
...(value.data || {}),
@@ -300,11 +300,11 @@ function normalizeNode(key, value, kind) {
}
}
return CREATORS[kind](tagName, attrs, children)
return CREATORS[object](tagName, attrs, children)
}
}
throw new Error(`Slate hyperscript ${kind} creators can be either functions, objects or strings, but you passed: ${value}`)
throw new Error(`Slate hyperscript ${object} creators can be either functions, objects or strings, but you passed: ${value}`)
}
/**