react-inlinesvg 0.7.4 → 0.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  [![NPM version](https://badge.fury.io/js/react-inlinesvg.svg)](https://www.npmjs.com/package/react-inlinesvg)
4
4
  [![build status](https://travis-ci.org/gilbarbara/react-inlinesvg.svg)](https://travis-ci.org/gilbarbara/react-inlinesvg)
5
+ [![dependencies Status](https://david-dm.org/gilbarbara/react-inlinesvg/status.svg)](https://david-dm.org/gilbarbara/react-inlinesvg)
5
6
  [![Maintainability](https://api.codeclimate.com/v1/badges/c7e42fe511b80cc25760/maintainability)](https://codeclimate.com/github/gilbarbara/react-inlinesvg/maintainability)
6
7
  [![Test Coverage](https://api.codeclimate.com/v1/badges/c7e42fe511b80cc25760/test_coverage)](https://codeclimate.com/github/gilbarbara/react-inlinesvg/test_coverage)
7
8
 
package/es/index.js CHANGED
@@ -195,7 +195,7 @@ var InlineSVG = function (_React$PureComponent) {
195
195
 
196
196
 
197
197
  if (uniquifyIDs) {
198
- return uniquifySVGIDs(svgText, uniqueHash);
198
+ return uniquifySVGIDs(svgText, uniqueHash || randomString());
199
199
  }
200
200
 
201
201
  return svgText;
@@ -255,7 +255,6 @@ InlineSVG.defaultProps = {
255
255
  onLoad: function onLoad() {},
256
256
  supportTest: isSupportedEnvironment,
257
257
  uniquifyIDs: true,
258
- uniqueHash: randomString(),
259
258
  wrapper: React.createFactory('span')
260
259
  };
261
260
  export default InlineSVG;
package/es/utils.js CHANGED
@@ -20,7 +20,7 @@ export var supportsInlineSVG = once(function () {
20
20
  });
21
21
 
22
22
  export var isSupportedEnvironment = once(function () {
23
- return ((typeof window !== 'undefined' && window !== null ? window.XMLHttpRequest : false) || (typeof window !== 'undefined' && window !== null ? window.XDomainRequest : false)) && supportsInlineSVG();
23
+ return supportsInlineSVG() && typeof window !== 'undefined' && window !== null ? window.XMLHttpRequest || window.XDomainRequest : false;
24
24
  });
25
25
 
26
26
  export var randomString = function randomString() {
package/lib/index.js CHANGED
@@ -212,7 +212,7 @@ var InlineSVG = function (_React$PureComponent) {
212
212
 
213
213
 
214
214
  if (uniquifyIDs) {
215
- return (0, _utils.uniquifySVGIDs)(svgText, uniqueHash);
215
+ return (0, _utils.uniquifySVGIDs)(svgText, uniqueHash || (0, _utils.randomString)());
216
216
  }
217
217
 
218
218
  return svgText;
@@ -272,7 +272,6 @@ InlineSVG.defaultProps = {
272
272
  onLoad: function onLoad() {},
273
273
  supportTest: _utils.isSupportedEnvironment,
274
274
  uniquifyIDs: true,
275
- uniqueHash: (0, _utils.randomString)(),
276
275
  wrapper: _react2.default.createFactory('span')
277
276
  };
278
277
  exports.default = InlineSVG;
package/lib/utils.js CHANGED
@@ -29,7 +29,7 @@ var supportsInlineSVG = exports.supportsInlineSVG = (0, _once2.default)(function
29
29
  });
30
30
 
31
31
  var isSupportedEnvironment = exports.isSupportedEnvironment = (0, _once2.default)(function () {
32
- return ((typeof window !== 'undefined' && window !== null ? window.XMLHttpRequest : false) || (typeof window !== 'undefined' && window !== null ? window.XDomainRequest : false)) && supportsInlineSVG();
32
+ return supportsInlineSVG() && typeof window !== 'undefined' && window !== null ? window.XMLHttpRequest || window.XDomainRequest : false;
33
33
  });
34
34
 
35
35
  var randomString = exports.randomString = function randomString() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-inlinesvg",
3
- "version": "0.7.4",
3
+ "version": "0.7.5",
4
4
  "description": "An SVG loader for React",
5
5
  "repository": {
6
6
  "type": "git",
@@ -40,48 +40,48 @@
40
40
  "once": "^1.4.0"
41
41
  },
42
42
  "devDependencies": {
43
+ "babel-cli": "^6.26.0",
43
44
  "babel-core": "^6.26.0",
44
- "babel-eslint": "^8.0.3",
45
- "babel-jest": "^21.2.0",
45
+ "babel-eslint": "^8.2.1",
46
+ "babel-jest": "^22.1.0",
46
47
  "babel-plugin-array-includes": "^2.0.3",
47
48
  "babel-plugin-transform-flow-strip-types": "^6.22.0",
48
49
  "babel-plugin-transform-object-assign": "^6.22.0",
49
50
  "babel-preset-env": "^1.6.1",
50
51
  "babel-preset-react": "^6.24.1",
51
52
  "babel-preset-stage-1": "^6.24.1",
52
- "babel-register": "^6.26.0",
53
53
  "babelify": "^8.0.0",
54
- "browserify": "^14.5.0",
54
+ "browserify": "^15.2.0",
55
55
  "browserify-shim": "^3.8.14",
56
56
  "chalk": "^2.3.0",
57
57
  "cors": "^2.8.4",
58
- "cross-env": "^5.1.1",
59
- "enzyme": "^3.2.0",
60
- "enzyme-adapter-react-16": "^1.1.0",
61
- "eslint": "^4.12.1",
58
+ "cross-env": "^5.1.3",
59
+ "enzyme": "^3.3.0",
60
+ "enzyme-adapter-react-16": "^1.1.1",
61
+ "eslint": "^4.16.0",
62
62
  "eslint-config-airbnb": "^16.1.0",
63
63
  "eslint-plugin-import": "^2.8.0",
64
- "eslint-plugin-jsx-a11y": "^6.0.2",
65
- "eslint-plugin-react": "^7.5.1",
64
+ "eslint-plugin-jsx-a11y": "^6.0.3",
65
+ "eslint-plugin-react": "^7.6.1",
66
66
  "gulp": "^3.9.1",
67
- "gulp-babel": "^7.0.0",
68
- "gulp-bump": "^2.8.0",
67
+ "gulp-babel": "^7.0.1",
68
+ "gulp-bump": "^3.0.0",
69
69
  "gulp-concat": "^2.6.1",
70
- "gulp-connect": "^5.0.0",
70
+ "gulp-connect": "^5.2.0",
71
71
  "gulp-load-plugins": "^1.5.0",
72
72
  "gulp-rename": "^1.2.2",
73
73
  "gulp-util": "^3.0.8",
74
74
  "husky": "^0.14.3",
75
- "jest": "^21.2.1",
76
- "jest-enzyme": "^4.0.1",
77
- "jsdom": "^11.5.1",
75
+ "jest": "^22.1.4",
76
+ "jest-enzyme": "^4.1.1",
77
+ "jsdom": "^11.6.2",
78
78
  "react": "^16.2.0",
79
79
  "react-addons-test-utils": "^15.6.2",
80
80
  "react-dom": "^16.2.0",
81
81
  "react-test-renderer": "^16.2.0",
82
82
  "rimraf": "^2.6.2",
83
- "vinyl-source-stream": "^1.1.0",
84
- "yargs": "^10.0.3"
83
+ "vinyl-source-stream": "^2.0.0",
84
+ "yargs": "^11.0.0"
85
85
  },
86
86
  "scripts": {
87
87
  "build": "npm run clean && npm run build:commonjs && npm run build:es && npm run build:standalone",
@@ -98,7 +98,11 @@
98
98
  "postmerge": "node tasks update",
99
99
  "prepublishOnly": "npm run build"
100
100
  },
101
- "browserslist": ["last 2 versions", "safari >= 8", "ios > 8"],
101
+ "browserslist": [
102
+ "last 2 versions",
103
+ "safari >= 8",
104
+ "ios > 8"
105
+ ],
102
106
  "browserify": {
103
107
  "transform": [
104
108
  [
package/src/index.js CHANGED
@@ -54,7 +54,6 @@ export default class InlineSVG extends React.PureComponent {
54
54
  onLoad: () => {},
55
55
  supportTest: isSupportedEnvironment,
56
56
  uniquifyIDs: true,
57
- uniqueHash: randomString(),
58
57
  wrapper: React.createFactory('span'),
59
58
  };
60
59
 
@@ -188,7 +187,7 @@ export default class InlineSVG extends React.PureComponent {
188
187
  const { uniquifyIDs, uniqueHash } = this.props;
189
188
 
190
189
  if (uniquifyIDs) {
191
- return uniquifySVGIDs(svgText, uniqueHash);
190
+ return uniquifySVGIDs(svgText, uniqueHash || randomString());
192
191
  }
193
192
 
194
193
  return svgText;
package/src/utils.js CHANGED
@@ -13,10 +13,11 @@ export const supportsInlineSVG = once(() => {
13
13
 
14
14
  export const isSupportedEnvironment = once(() =>
15
15
  (
16
- (typeof window !== 'undefined' && window !== null ? window.XMLHttpRequest : false) ||
17
- (typeof window !== 'undefined' && window !== null ? window.XDomainRequest : false)
16
+ supportsInlineSVG() &&
17
+ typeof window !== 'undefined' && window !== null
18
+ ? window.XMLHttpRequest || window.XDomainRequest
19
+ : false
18
20
  )
19
- && supportsInlineSVG()
20
21
  );
21
22
 
22
23
  export const randomString = (length = 8) => {