mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-04-21 13:51:59 +02:00
add data model
This commit is contained in:
parent
74cab690e3
commit
e9538526ce
32
lib/models/data.js
Normal file
32
lib/models/data.js
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
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
|
Loading…
x
Reference in New Issue
Block a user