-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbundle.js
37 lines (33 loc) · 892 Bytes
/
bundle.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// A bundle is an object that both describes and contains a gist data element
/**
* data should be in a format ready to be placed in a gist file
*
* meta should contain at a minimum:
* - "dataType": The key of the dataType plugin this bundle represents
* - "name": Either a short identifier, or if this represents a
* file, then a relative path to the file ending with the filename
*
* meta can also contain any other data that the data type supports
*/
module.exports = (data, meta) => {
function getData () {
return data
}
function getMeta () {
return meta
}
function setData (newData) {
data = newData
}
function setMeta (newMeta) {
meta = newMeta
}
return {
name: () => meta.name,
dataType: () => meta.dataType,
getData,
setData,
getMeta,
setMeta
}
}