PageRenderTime 55ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 1ms

/node_modules/object.assign/dist/browser.js

https://gitlab.com/gtekelis/modbus_project
JavaScript | 477 lines | 393 code | 69 blank | 15 comment | 100 complexity | db7fef4340cda5c59bbd56134b0d2a69 MD5 | raw file
  1. (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
  2. 'use strict';
  3. var keys = require('object-keys').shim();
  4. delete keys.shim;
  5. var assign = require('./');
  6. module.exports = assign.shim();
  7. delete assign.shim;
  8. },{"./":4,"object-keys":9}],2:[function(require,module,exports){
  9. 'use strict';
  10. var keys = require('object-keys');
  11. module.exports = function hasSymbols() {
  12. if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
  13. if (typeof Symbol.iterator === 'symbol') { return true; }
  14. var obj = {};
  15. var sym = Symbol('test');
  16. var symObj = Object(sym);
  17. if (typeof sym === 'string') { return false; }
  18. if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
  19. if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
  20. // temp disabled per https://github.com/ljharb/object.assign/issues/17
  21. // if (sym instanceof Symbol) { return false; }
  22. // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
  23. // if (!(symObj instanceof Symbol)) { return false; }
  24. var symVal = 42;
  25. obj[sym] = symVal;
  26. for (sym in obj) { return false; }
  27. if (keys(obj).length !== 0) { return false; }
  28. if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
  29. if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
  30. var syms = Object.getOwnPropertySymbols(obj);
  31. if (syms.length !== 1 || syms[0] !== sym) { return false; }
  32. if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
  33. if (typeof Object.getOwnPropertyDescriptor === 'function') {
  34. var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
  35. if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
  36. }
  37. return true;
  38. };
  39. },{"object-keys":9}],3:[function(require,module,exports){
  40. 'use strict';
  41. // modified from https://github.com/es-shims/es6-shim
  42. var keys = require('object-keys');
  43. var bind = require('function-bind');
  44. var canBeObject = function (obj) {
  45. return typeof obj !== 'undefined' && obj !== null;
  46. };
  47. var hasSymbols = require('./hasSymbols')();
  48. var toObject = Object;
  49. var push = bind.call(Function.call, Array.prototype.push);
  50. var propIsEnumerable = bind.call(Function.call, Object.prototype.propertyIsEnumerable);
  51. var originalGetSymbols = hasSymbols ? Object.getOwnPropertySymbols : null;
  52. module.exports = function assign(target, source1) {
  53. if (!canBeObject(target)) { throw new TypeError('target must be an object'); }
  54. var objTarget = toObject(target);
  55. var s, source, i, props, syms, value, key;
  56. for (s = 1; s < arguments.length; ++s) {
  57. source = toObject(arguments[s]);
  58. props = keys(source);
  59. var getSymbols = hasSymbols && (Object.getOwnPropertySymbols || originalGetSymbols);
  60. if (getSymbols) {
  61. syms = getSymbols(source);
  62. for (i = 0; i < syms.length; ++i) {
  63. key = syms[i];
  64. if (propIsEnumerable(source, key)) {
  65. push(props, key);
  66. }
  67. }
  68. }
  69. for (i = 0; i < props.length; ++i) {
  70. key = props[i];
  71. value = source[key];
  72. if (propIsEnumerable(source, key)) {
  73. objTarget[key] = value;
  74. }
  75. }
  76. }
  77. return objTarget;
  78. };
  79. },{"./hasSymbols":2,"function-bind":8,"object-keys":9}],4:[function(require,module,exports){
  80. 'use strict';
  81. var defineProperties = require('define-properties');
  82. var implementation = require('./implementation');
  83. var getPolyfill = require('./polyfill');
  84. var shim = require('./shim');
  85. var polyfill = getPolyfill();
  86. defineProperties(polyfill, {
  87. implementation: implementation,
  88. getPolyfill: getPolyfill,
  89. shim: shim
  90. });
  91. module.exports = polyfill;
  92. },{"./implementation":3,"./polyfill":11,"./shim":12,"define-properties":5}],5:[function(require,module,exports){
  93. 'use strict';
  94. var keys = require('object-keys');
  95. var foreach = require('foreach');
  96. var hasSymbols = typeof Symbol === 'function' && typeof Symbol() === 'symbol';
  97. var toStr = Object.prototype.toString;
  98. var isFunction = function (fn) {
  99. return typeof fn === 'function' && toStr.call(fn) === '[object Function]';
  100. };
  101. var arePropertyDescriptorsSupported = function () {
  102. var obj = {};
  103. try {
  104. Object.defineProperty(obj, 'x', { enumerable: false, value: obj });
  105. /* eslint-disable no-unused-vars, no-restricted-syntax */
  106. for (var _ in obj) { return false; }
  107. /* eslint-enable no-unused-vars, no-restricted-syntax */
  108. return obj.x === obj;
  109. } catch (e) { /* this is IE 8. */
  110. return false;
  111. }
  112. };
  113. var supportsDescriptors = Object.defineProperty && arePropertyDescriptorsSupported();
  114. var defineProperty = function (object, name, value, predicate) {
  115. if (name in object && (!isFunction(predicate) || !predicate())) {
  116. return;
  117. }
  118. if (supportsDescriptors) {
  119. Object.defineProperty(object, name, {
  120. configurable: true,
  121. enumerable: false,
  122. value: value,
  123. writable: true
  124. });
  125. } else {
  126. object[name] = value;
  127. }
  128. };
  129. var defineProperties = function (object, map) {
  130. var predicates = arguments.length > 2 ? arguments[2] : {};
  131. var props = keys(map);
  132. if (hasSymbols) {
  133. props = props.concat(Object.getOwnPropertySymbols(map));
  134. }
  135. foreach(props, function (name) {
  136. defineProperty(object, name, map[name], predicates[name]);
  137. });
  138. };
  139. defineProperties.supportsDescriptors = !!supportsDescriptors;
  140. module.exports = defineProperties;
  141. },{"foreach":6,"object-keys":9}],6:[function(require,module,exports){
  142. var hasOwn = Object.prototype.hasOwnProperty;
  143. var toString = Object.prototype.toString;
  144. module.exports = function forEach (obj, fn, ctx) {
  145. if (toString.call(fn) !== '[object Function]') {
  146. throw new TypeError('iterator must be a function');
  147. }
  148. var l = obj.length;
  149. if (l === +l) {
  150. for (var i = 0; i < l; i++) {
  151. fn.call(ctx, obj[i], i, obj);
  152. }
  153. } else {
  154. for (var k in obj) {
  155. if (hasOwn.call(obj, k)) {
  156. fn.call(ctx, obj[k], k, obj);
  157. }
  158. }
  159. }
  160. };
  161. },{}],7:[function(require,module,exports){
  162. var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
  163. var slice = Array.prototype.slice;
  164. var toStr = Object.prototype.toString;
  165. var funcType = '[object Function]';
  166. module.exports = function bind(that) {
  167. var target = this;
  168. if (typeof target !== 'function' || toStr.call(target) !== funcType) {
  169. throw new TypeError(ERROR_MESSAGE + target);
  170. }
  171. var args = slice.call(arguments, 1);
  172. var bound;
  173. var binder = function () {
  174. if (this instanceof bound) {
  175. var result = target.apply(
  176. this,
  177. args.concat(slice.call(arguments))
  178. );
  179. if (Object(result) === result) {
  180. return result;
  181. }
  182. return this;
  183. } else {
  184. return target.apply(
  185. that,
  186. args.concat(slice.call(arguments))
  187. );
  188. }
  189. };
  190. var boundLength = Math.max(0, target.length - args.length);
  191. var boundArgs = [];
  192. for (var i = 0; i < boundLength; i++) {
  193. boundArgs.push('$' + i);
  194. }
  195. bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
  196. if (target.prototype) {
  197. var Empty = function Empty() {};
  198. Empty.prototype = target.prototype;
  199. bound.prototype = new Empty();
  200. Empty.prototype = null;
  201. }
  202. return bound;
  203. };
  204. },{}],8:[function(require,module,exports){
  205. var implementation = require('./implementation');
  206. module.exports = Function.prototype.bind || implementation;
  207. },{"./implementation":7}],9:[function(require,module,exports){
  208. 'use strict';
  209. // modified from https://github.com/es-shims/es5-shim
  210. var has = Object.prototype.hasOwnProperty;
  211. var toStr = Object.prototype.toString;
  212. var slice = Array.prototype.slice;
  213. var isArgs = require('./isArguments');
  214. var isEnumerable = Object.prototype.propertyIsEnumerable;
  215. var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');
  216. var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
  217. var dontEnums = [
  218. 'toString',
  219. 'toLocaleString',
  220. 'valueOf',
  221. 'hasOwnProperty',
  222. 'isPrototypeOf',
  223. 'propertyIsEnumerable',
  224. 'constructor'
  225. ];
  226. var equalsConstructorPrototype = function (o) {
  227. var ctor = o.constructor;
  228. return ctor && ctor.prototype === o;
  229. };
  230. var excludedKeys = {
  231. $console: true,
  232. $external: true,
  233. $frame: true,
  234. $frameElement: true,
  235. $frames: true,
  236. $height: true,
  237. $parent: true,
  238. $self: true,
  239. $webkitIndexedDB: true,
  240. $webkitStorageInfo: true,
  241. $width: true,
  242. $window: true
  243. };
  244. var hasAutomationEqualityBug = (function () {
  245. /* global window */
  246. if (typeof window === 'undefined') { return false; }
  247. for (var k in window) {
  248. try {
  249. if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
  250. try {
  251. equalsConstructorPrototype(window[k]);
  252. } catch (e) {
  253. return true;
  254. }
  255. }
  256. } catch (e) {
  257. return true;
  258. }
  259. }
  260. return false;
  261. }());
  262. var equalsConstructorPrototypeIfNotBuggy = function (o) {
  263. /* global window */
  264. if (typeof window === 'undefined' || !hasAutomationEqualityBug) {
  265. return equalsConstructorPrototype(o);
  266. }
  267. try {
  268. return equalsConstructorPrototype(o);
  269. } catch (e) {
  270. return false;
  271. }
  272. };
  273. var keysShim = function keys(object) {
  274. var isObject = object !== null && typeof object === 'object';
  275. var isFunction = toStr.call(object) === '[object Function]';
  276. var isArguments = isArgs(object);
  277. var isString = isObject && toStr.call(object) === '[object String]';
  278. var theKeys = [];
  279. if (!isObject && !isFunction && !isArguments) {
  280. throw new TypeError('Object.keys called on a non-object');
  281. }
  282. var skipProto = hasProtoEnumBug && isFunction;
  283. if (isString && object.length > 0 && !has.call(object, 0)) {
  284. for (var i = 0; i < object.length; ++i) {
  285. theKeys.push(String(i));
  286. }
  287. }
  288. if (isArguments && object.length > 0) {
  289. for (var j = 0; j < object.length; ++j) {
  290. theKeys.push(String(j));
  291. }
  292. } else {
  293. for (var name in object) {
  294. if (!(skipProto && name === 'prototype') && has.call(object, name)) {
  295. theKeys.push(String(name));
  296. }
  297. }
  298. }
  299. if (hasDontEnumBug) {
  300. var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
  301. for (var k = 0; k < dontEnums.length; ++k) {
  302. if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
  303. theKeys.push(dontEnums[k]);
  304. }
  305. }
  306. }
  307. return theKeys;
  308. };
  309. keysShim.shim = function shimObjectKeys() {
  310. if (Object.keys) {
  311. var keysWorksWithArguments = (function () {
  312. // Safari 5.0 bug
  313. return (Object.keys(arguments) || '').length === 2;
  314. }(1, 2));
  315. if (!keysWorksWithArguments) {
  316. var originalKeys = Object.keys;
  317. Object.keys = function keys(object) {
  318. if (isArgs(object)) {
  319. return originalKeys(slice.call(object));
  320. } else {
  321. return originalKeys(object);
  322. }
  323. };
  324. }
  325. } else {
  326. Object.keys = keysShim;
  327. }
  328. return Object.keys || keysShim;
  329. };
  330. module.exports = keysShim;
  331. },{"./isArguments":10}],10:[function(require,module,exports){
  332. 'use strict';
  333. var toStr = Object.prototype.toString;
  334. module.exports = function isArguments(value) {
  335. var str = toStr.call(value);
  336. var isArgs = str === '[object Arguments]';
  337. if (!isArgs) {
  338. isArgs = str !== '[object Array]' &&
  339. value !== null &&
  340. typeof value === 'object' &&
  341. typeof value.length === 'number' &&
  342. value.length >= 0 &&
  343. toStr.call(value.callee) === '[object Function]';
  344. }
  345. return isArgs;
  346. };
  347. },{}],11:[function(require,module,exports){
  348. 'use strict';
  349. var implementation = require('./implementation');
  350. var lacksProperEnumerationOrder = function () {
  351. if (!Object.assign) {
  352. return false;
  353. }
  354. // v8, specifically in node 4.x, has a bug with incorrect property enumeration order
  355. // note: this does not detect the bug unless there's 20 characters
  356. var str = 'abcdefghijklmnopqrst';
  357. var letters = str.split('');
  358. var map = {};
  359. for (var i = 0; i < letters.length; ++i) {
  360. map[letters[i]] = letters[i];
  361. }
  362. var obj = Object.assign({}, map);
  363. var actual = '';
  364. for (var k in obj) {
  365. actual += k;
  366. }
  367. return str !== actual;
  368. };
  369. var assignHasPendingExceptions = function () {
  370. if (!Object.assign || !Object.preventExtensions) {
  371. return false;
  372. }
  373. // Firefox 37 still has "pending exception" logic in its Object.assign implementation,
  374. // which is 72% slower than our shim, and Firefox 40's native implementation.
  375. var thrower = Object.preventExtensions({ 1: 2 });
  376. try {
  377. Object.assign(thrower, 'xy');
  378. } catch (e) {
  379. return thrower[1] === 'y';
  380. }
  381. return false;
  382. };
  383. module.exports = function getPolyfill() {
  384. if (!Object.assign) {
  385. return implementation;
  386. }
  387. if (lacksProperEnumerationOrder()) {
  388. return implementation;
  389. }
  390. if (assignHasPendingExceptions()) {
  391. return implementation;
  392. }
  393. return Object.assign;
  394. };
  395. },{"./implementation":3}],12:[function(require,module,exports){
  396. 'use strict';
  397. var define = require('define-properties');
  398. var getPolyfill = require('./polyfill');
  399. module.exports = function shimAssign() {
  400. var polyfill = getPolyfill();
  401. define(
  402. Object,
  403. { assign: polyfill },
  404. { assign: function () { return Object.assign !== polyfill; } }
  405. );
  406. return polyfill;
  407. };
  408. },{"./polyfill":11,"define-properties":5}]},{},[1]);