forked from purescript-contrib/purescript-arraybuffer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDataView.js
45 lines (36 loc) · 856 Bytes
/
DataView.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
38
39
40
41
42
43
44
45
"use strict";
// module Data.ArrayBuffer.DataView
exports.whole = function(b) {
return new DataView(b);
}
exports.sliceImpl = function(just, nothing, s, l, b) {
return ((s + l)>>>0) <= b.byteLength ? just(new DataView(b, s, l)) : nothing;
}
exports.buffer = function(v) {
return v.buffer;
}
exports.byteOffset = function(v) {
return v.byteOffset;
}
exports.byteLength = function(v) {
return v.byteLength;
}
exports.getterImpl = function(just, nothing, s, l, e, v, o) {
return function() {
return ((o + l)>>>0) <= v.byteLength? just(v[s].call(v,o,e)) : nothing;
};
}
exports.setter = function(s) {
return function(e) {
return function(v) {
var f = v[s];
return function(n) {
return function(o) {
return function() {
f.call(v,o,n,e);
};
};
};
};
};
}