1 var _createClass = function() {
2 function defineProperties(target, props) {
3 for (var i = 0; i < props.length; i++) {
4 var descriptor = props[i];
5 descriptor.enumerable = descriptor.enumerable || false;
6 descriptor.configurable = true;
7 if ("value" in descriptor) descriptor.writable = true;
8 Object.defineProperty(target, descriptor.key, descriptor);
11 return function(Constructor, protoProps, staticProps) {
12 if (protoProps) defineProperties(Constructor.prototype, protoProps);
13 if (staticProps) defineProperties(Constructor, staticProps);
18 function _classCallCheck(instance, Constructor) {
19 if (!(instance instanceof Constructor)) {
20 throw new TypeError("Cannot call a class as a function");
23 var IoTString = function() {
24 function IoTString(arg) {
25 _classCallCheck(this, IoTString);
26 if (arg === undefined) {
27 this.array = new Uint8Array();
29 } else if (arg && typeof arg === "string") {
30 this.array = new Uint8Array(arg.length);
31 for (var i = 0; i < arg.length; ++i) {
32 this.array[i] = arg.charCodeAt(i);
34 this.hashcode = hash(this.array);
35 } else if (arg && arg instanceof Uint8Array) {
37 this.hashcode = hashcode(arg);
40 _createClass(IoTString, [{
42 value: function shallow(arg) {
43 if (arg && arg instanceof Uint8Array) {
44 var i = new IotString(arg);
50 value: function internalBytes() {
55 value: function hashCode() {
60 value: function toString() {
61 return this.array.toString();
65 value: function getBytes() {
67 return _.extend(obj, this.array);
71 value: function equals(arr) {
72 return _.isEqual(arr, this.array);
76 value: function length() {
77 return this.array.length;