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

iconly

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iconly - npm Package Compare versions

Comparing version 1.2.2 to 1.3.0

6

dist/index.js

@@ -0,4 +1,6 @@

function $parcel$defineInteropFlag(a) {
Object.defineProperty(a, '__esModule', {value: true, configurable: true});
}
function $parcel$export(e, n, v, s) {

@@ -11,3 +13,3 @@ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});

$parcel$export(module.exports, "default", () => $4fa36e821943b400$export$2e2bcd8739ae039);
class $4fa36e821943b400$export$2e2bcd8739ae039 {
class $4fa36e821943b400$var$Iconly {
constructor(options){

@@ -20,3 +22,2 @@ this.options = {

this.body = document.body;
this.init().then();
}

@@ -53,4 +54,5 @@ async init() {

}
var $4fa36e821943b400$export$2e2bcd8739ae039 = $4fa36e821943b400$var$Iconly;
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

class $cf838c15c8b009ba$export$2e2bcd8739ae039 {
class $cf838c15c8b009ba$var$Iconly {
constructor(options){

@@ -9,3 +9,2 @@ this.options = {

this.body = document.body;
this.init().then();
}

@@ -42,2 +41,3 @@ async init() {

}
var $cf838c15c8b009ba$export$2e2bcd8739ae039 = $cf838c15c8b009ba$var$Iconly;

@@ -44,0 +44,0 @@

{
"name": "iconly",
"version": "1.2.2",
"version": "1.3.0",
"description": "SVG Sprite",

@@ -14,12 +14,24 @@ "author": "ux-ui.pro",

},
"source": "src/index.js",
"main": "dist/index.js",
"module": "dist/index.module.js",
"targets": {
"main": {
"source": "src/index.js"
},
"module": {
"source": "src/index.js"
}
},
"scripts": {
"serve": "parcel watch",
"build": "parcel build",
"clean": "rm -rf dist .parcel-cache"
"clean": "rm -rf dist .parcel-cache",
"build": "yarn clean && parcel build",
"lint:js": "eslint --ext .js",
"lintfix": "yarn lint:js --fix"
},
"devDependencies": {
"parcel": "~2.9.3"
"eslint": "^7.32.0 || ^8.56.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.29.1",
"parcel": "^2.11.0",
"postcss-html": "^1.6.0"
},

@@ -33,2 +45,2 @@ "keywords": [

]
}
}

@@ -25,9 +25,11 @@ <div align="center">

```javascript
import Iconly from 'iconly'
import Iconly from 'iconly';
```
```javascript
new Iconly({
file: './icons.svg'
})
const icons = new Iconly({
file: '/sprite.svg',
});
icons.init();
```

@@ -61,2 +63,2 @@ <br>

### License
<sup>iconly is released under MIT license</sup>
<sup>iconly is released under MIT license</sup>

@@ -1,38 +0,36 @@

export default class Iconly {
class Iconly {
constructor(options) {
this.options = { file: './icons.svg', ...options }
this.isLocalStorage = typeof window.localStorage !== 'undefined'
this.body = document.body
this.init().then()
this.options = { file: './icons.svg', ...options };
this.isLocalStorage = typeof window.localStorage !== 'undefined';
this.body = document.body;
}
async init() {
const { file } = this.options
const { file } = this.options;
if (this.isLocalStorage) {
const storedSize = localStorage.getItem('inlineSVGsize')
const storedData = localStorage.getItem('inlineSVGdata')
const response = await fetch(file)
const storedSize = localStorage.getItem('inlineSVGsize');
const storedData = localStorage.getItem('inlineSVGdata');
const response = await fetch(file);
if (!response.ok) throw new Error('Network response was not ok')
if (!response.ok) throw new Error('Network response was not ok');
const data = await response.text()
const data = await response.text();
if (storedSize && storedSize === data.length.toString()) {
this.insert(storedData)
this.insert(storedData);
} else {
this.insert(data)
this.insert(data);
localStorage.setItem('inlineSVGdata', data)
localStorage.setItem('inlineSVGsize', data.length.toString())
localStorage.setItem('inlineSVGdata', data);
localStorage.setItem('inlineSVGsize', data.length.toString());
}
} else {
const response = await fetch(file)
const response = await fetch(file);
if (!response.ok) throw new Error('Network response was not ok')
if (!response.ok) throw new Error('Network response was not ok');
const data = await response.text()
const data = await response.text();
this.insert(data)
this.insert(data);
}

@@ -44,10 +42,12 @@ }

if (this.body) {
this.body.insertAdjacentHTML('beforeend', data)
this.body.insertAdjacentHTML('beforeend', data);
} else {
document.addEventListener('DOMContentLoaded', () => {
this.body.insertAdjacentHTML('beforeend', data)
})
this.body.insertAdjacentHTML('beforeend', data);
});
}
}
}
}
}
export default Iconly;

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