1 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
3 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5 var IoTString = function () {
6 function IoTString(arg) {
7 _classCallCheck(this, IoTString);
9 if (arg === undefined) {
10 this.array = new Uint8Array();
12 } else if (arg && typeof arg === "string") {
13 this.array = new Uint8Array(arg.length);
14 for (var i = 0; i < arg.length; ++i) {
15 this.array[i] = arg.charCodeAt(i);
17 this.hashcode = hash(this.array);
18 } else if (arg && arg instanceof Uint8Array) {
20 this.hashcode = hashcode(arg);
24 _createClass(IoTString, [{
26 value: function shallow(arg) {
27 if (arg && arg instanceof Uint8Array) {
28 var i = new IotString(arg);
34 value: function internalBytes() {
39 value: function hashCode() {
44 value: function toString() {
45 return this.array.toString();
49 value: function getBytes() {
51 return _.extend(obj, this.array);
55 value: function equals(arr) {
56 return _.isEqual(arr, this.array);
60 value: function length() {
61 return this.array.length;