mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-02-24 17:23:07 +01:00
33 lines
473 B
JavaScript
33 lines
473 B
JavaScript
|
|
||
|
import { Map } from 'immutable'
|
||
|
|
||
|
/**
|
||
|
* Data.
|
||
|
*
|
||
|
* This isn't an immutable record, it's just a thin wrapper around `Map` so that
|
||
|
* we can allow for more convenient creation.
|
||
|
*/
|
||
|
|
||
|
const Data = {
|
||
|
|
||
|
/**
|
||
|
* Create a new `Data` with `properties`.
|
||
|
*
|
||
|
* @param {Object} properties
|
||
|
* @return {Data} data
|
||
|
*/
|
||
|
|
||
|
create(properties = {}) {
|
||
|
return Map.isMap(properties)
|
||
|
? properties
|
||
|
: new Map(properties)
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Export.
|
||
|
*/
|
||
|
|
||
|
export default Data
|