Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

has-symbol-support-x

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

has-symbol-support-x - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

dist/has-symbol-support-x.esm.js

206

dist/has-symbol-support-x.js
/*!
{
"author": "Graham Fairweather",
"copywrite": "Copyright (c) 2015-present",
"date": "2019-07-10T17:50:14.483Z",
"date": "2019-07-12T13:35:23.603Z",
"describe": "",
"description": "Tests if ES6 Symbol is supported.",
"file": "has-symbol-support-x.js",
"hash": "97652fb9c620511744ef",
"hash": "62534d28d54e7a515f3c",
"license": "MIT",
"version": "2.0.0"
"version": "2.0.1"
}

@@ -122,3 +123,3 @@ */

/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ return __webpack_require__(__webpack_require__.s = 4);
/******/ })

@@ -133,10 +134,190 @@ /************************************************************************/

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var toStr = Object.prototype.toString;
var hasSymbols = __webpack_require__(1)();
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
if (hasSymbols) {
var symToStr = Symbol.prototype.toString;
var symStringRegex = /^Symbol\(.*\)$/;
var isSymbolObject = function isRealSymbolObject(value) {
if (typeof value.valueOf() !== 'symbol') {
return false;
}
return symStringRegex.test(symToStr.call(value));
};
module.exports = function isSymbol(value) {
if (typeof value === 'symbol') {
return true;
}
if (toStr.call(value) !== '[object Symbol]') {
return false;
}
try {
return isSymbolObject(value);
} catch (e) {
return false;
}
};
} else {
module.exports = function isSymbol(value) {
// this environment does not support Symbols.
return false && false;
};
}
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global) {
var origSymbol = global.Symbol;
var hasSymbolSham = __webpack_require__(3);
module.exports = function hasNativeSymbols() {
if (typeof origSymbol !== 'function') { return false; }
if (typeof Symbol !== 'function') { return false; }
if (typeof origSymbol('foo') !== 'symbol') { return false; }
if (typeof Symbol('bar') !== 'symbol') { return false; }
return hasSymbolSham();
};
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(2)))
/***/ }),
/* 2 */
/***/ (function(module, exports) {
var g;
// This works in non-strict mode
g = (function() {
return this;
})();
try {
// This works if eval is allowed (see CSP)
g = g || new Function("return this")();
} catch (e) {
// This works if the window reference is available
if (typeof window === "object") g = window;
}
// g can still be undefined, but nothing to do about it...
// We return undefined, instead of nothing here, so it's
// easier to handle this case. if(!global) { ...}
module.exports = g;
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* eslint complexity: [2, 17], max-statements: [2, 33] */
module.exports = function hasSymbols() {
if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
if (typeof Symbol.iterator === 'symbol') { return true; }
var obj = {};
var sym = Symbol('test');
var symObj = Object(sym);
if (typeof sym === 'string') { return false; }
if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
// temp disabled per https://github.com/ljharb/object.assign/issues/17
// if (sym instanceof Symbol) { return false; }
// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
// if (!(symObj instanceof Symbol)) { return false; }
// if (typeof Symbol.prototype.toString !== 'function') { return false; }
// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
var symVal = 42;
obj[sym] = symVal;
for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax
if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
var syms = Object.getOwnPropertySymbols(obj);
if (syms.length !== 1 || syms[0] !== sym) { return false; }
if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
if (typeof Object.getOwnPropertyDescriptor === 'function') {
var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
}
return true;
};
/***/ }),
/* 4 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
// CONCATENATED MODULE: ./node_modules/attempt-x/dist/attempt-x.esm.js
/**
* This method attempts to invoke the function, returning either the result or
* the caught error object. Any additional arguments are provided to the
* function when it's invoked.
*
* @param {Function} [fn] - The function to attempt.
* @param {...*} [args] - The arguments to invoke the function with.
* @returns {object} Returns an object of the result.
*/
function attempt(fn) {
try {
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
return {
threw: false,
/* eslint-disable-next-line babel/no-invalid-this */
value: fn.apply(this, args)
};
} catch (e) {
return {
threw: true,
value: e
};
}
}
;
// EXTERNAL MODULE: ./node_modules/is-symbol/index.js
var is_symbol = __webpack_require__(0);
var is_symbol_default = /*#__PURE__*/__webpack_require__.n(is_symbol);
// CONCATENATED MODULE: ./dist/has-symbol-support-x.esm.js
var _this = undefined;
function _newArrowCheck(innerThis, boundThis) { if (innerThis !== boundThis) { throw new TypeError("Cannot instantiate an arrow function"); } }
var hasSymbolSupport = attempt(function () {
_newArrowCheck(this, _this);
/* eslint-disable-next-line compat/compat */
return typeof Symbol === 'function' && is_symbol_default()(Symbol(''));
}.bind(undefined));
/**
* Indicates if `Symbol`exists and creates the correct type.

@@ -147,8 +328,7 @@ * `true`, if it exists and creates the correct type, otherwise `false`.

*/
var _default = typeof Symbol === 'function' &&
/* eslint-disable-next-line compat/compat */
_typeof(Symbol('')) === 'symbol';
exports.default = _default;
/* harmony default export */ var has_symbol_support_x_esm = __webpack_exports__["default"] = (hasSymbolSupport.threw === false && hasSymbolSupport.value === true);
/***/ })

@@ -155,0 +335,0 @@ /******/ ]);

9

dist/has-symbol-support-x.min.js
/*!
{
"author": "Graham Fairweather",
"copywrite": "Copyright (c) 2015-present",
"date": "2019-07-10T17:50:14.483Z",
"date": "2019-07-12T13:35:23.603Z",
"describe": "",
"description": "Tests if ES6 Symbol is supported.",
"file": "has-symbol-support-x.min.js",
"hash": "6488216cfbdf5b4d5fba",
"hash": "066e208dc14487b723f0",
"license": "MIT",
"version": "2.0.0"
"version": "2.0.1"
}
*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.hasSymbolSupportX=t():e.hasSymbolSupportX=t()}(function(){"use strict";return"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:Function("return this")()}(),function(){return function(e){var t={};function o(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}return o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=0)}([function(e,t,o){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r="function"==typeof Symbol&&"symbol"===n(Symbol(""));t.default=r}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.hasSymbolSupportX=e():t.hasSymbolSupportX=e()}(function(){"use strict";return"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:Function("return this")()}(),function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=4)}([function(t,e,r){"use strict";var n=Object.prototype.toString;if(r(1)()){var o=Symbol.prototype.toString,u=/^Symbol\(.*\)$/;t.exports=function(t){if("symbol"==typeof t)return!0;if("[object Symbol]"!==n.call(t))return!1;try{return function(t){return"symbol"==typeof t.valueOf()&&u.test(o.call(t))}(t)}catch(t){return!1}}}else t.exports=function(t){return!1}},function(t,e,r){"use strict";(function(e){var n=e.Symbol,o=r(3);t.exports=function(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&o())))}}).call(this,r(2))},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),r=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(e in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var n=Object.getOwnPropertySymbols(t);if(1!==n.length||n[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(t,e);if(42!==o.value||!0!==o.enumerable)return!1}return!0}},function(t,e,r){"use strict";r.r(e);var n=r(0),o=r.n(n);var u=function(t){try{for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return{threw:!1,value:t.apply(this,r)}}catch(t){return{threw:!0,value:t}}}(function(){return function(t,e){if(t!==e)throw new TypeError("Cannot instantiate an arrow function")}(this,void 0),"function"==typeof Symbol&&o()(Symbol(""))}.bind(void 0));e.default=!1===u.threw&&!0===u.value}])});
//# sourceMappingURL=has-symbol-support-x.min.js.map
{
"name": "has-symbol-support-x",
"version": "2.0.0",
"version": "2.0.1",
"description": "Tests if ES6 Symbol is supported.",

@@ -23,8 +23,8 @@ "homepage": "https://github.com/Xotic750/has-symbol-support-x",

],
"browser": "dist/has-symbol-support-x.min.js",
"module": "src/has-symbol-support-x.js",
"module": "dist/has-symbol-support-x.esm.js",
"main": "dist/has-symbol-support-x.js",
"scripts": {
"build:esm": "mkdirp dist && babel -s true --env-name esm src/has-symbol-support-x.js -o dist/has-symbol-support-x.esm.js",
"build:base": "webpack --bail --progress --profile --colors",
"build": "cross-env NODE_ENV=production npm run build:base --",
"build": "npm run build:esm && cross-env NODE_ENV=production npm run build:base --",
"build:dev": "npm run build:base --",

@@ -52,6 +52,14 @@ "clean": "rimraf dist && npm run clean:coverage",

},
"dependencies": {},
"dependencies": {
"attempt-x": "^2.0.1",
"is-symbol": "^1.0.2"
},
"devDependencies": {
"@babel/cli": "^7.5.0",
"@babel/core": "^7.5.4",
"@babel/node": "^7.5.0",
"@babel/plugin-proposal-class-properties": "^7.5.0",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-syntax-export-default-from": "^7.2.0",
"@babel/plugin-syntax-export-namespace-from": "^7.2.0",
"@babel/plugin-transform-property-mutators": "^7.2.0",

@@ -61,10 +69,12 @@ "@babel/plugin-transform-runtime": "^7.5.0",

"@babel/runtime": "^7.5.4",
"@prorenata/eslint-config-vue": "^1.13.5",
"@prorenata/eslint-config-vue": "^1.13.6",
"@types/jest": "^24.0.15",
"@types/node": "^12.6.1",
"@typescript-eslint/eslint-plugin": "^1.11.0",
"@typescript-eslint/parser": "^1.11.0",
"@types/node": "^12.6.2",
"babel-core": "^7.0.0-0",
"babel-eslint": "^10.0.2",
"babel-loader": "^8.0.6",
"babel-plugin-lodash": "^3.3.4",
"caniuse-lite": "^1.0.30000983",
"chalk": "^2.4.2",
"concurrently": "^4.1.1",
"cross-env": "^5.2.0",

@@ -84,3 +94,3 @@ "eslint": "=5.16.0",

"eslint-plugin-jest": "^22.7.2",
"eslint-plugin-jsdoc": "^15.3.2",
"eslint-plugin-jsdoc": "^15.3.5",
"eslint-plugin-json": "^1.4.0",

@@ -96,10 +106,16 @@ "eslint-plugin-lodash": "^5.1.0",

"friendly-errors-webpack-plugin": "^1.7.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^24.8.0",
"jest-cli": "^24.8.0",
"jest-css": "^1.0.1",
"jest-file": "^1.0.0",
"lodash": "^4.17.13",
"jsdoc-to-markdown": "^5.0.0",
"lodash": "^4.17.14",
"lodash-webpack-plugin": "^0.11.5",
"mkdirp": "^0.5.1",
"node-notifier": "^5.4.0",
"nodemon": "^1.19.1",
"prettier": "=1.14.3",
"rimraf": "^2.6.3",
"semver": "^6.2.0",
"source-map-loader": "^0.2.4",
"terser-webpack-plugin": "^1.3.0",

@@ -106,0 +122,0 @@ "typescript": "^3.5.3",

@@ -0,1 +1,9 @@

import attempt from 'attempt-x';
import isSymbol from 'is-symbol';
const hasSymbolSupport = attempt(() => {
/* eslint-disable-next-line compat/compat */
return typeof Symbol === 'function' && isSymbol(Symbol(''));
});
/**

@@ -7,4 +15,2 @@ * Indicates if `Symbol`exists and creates the correct type.

*/
export default typeof Symbol === 'function' &&
/* eslint-disable-next-line compat/compat */
typeof Symbol('') === 'symbol';
export default hasSymbolSupport.threw === false && hasSymbolSupport.value === true;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc