Socket
Socket
Sign inDemoInstall

meteora

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.5 to 0.0.6

27

dist/index.js

@@ -13,5 +13,6 @@ function Event(event, params) {

exports.Event = Event;
function ajax(options) {
function ajax() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var httpRequest = new XMLHttpRequest();
var settings = Object.assign({
var settings = {
url: '/',

@@ -34,9 +35,11 @@ method: 'GET',

}
}, options);
}; // Object assign the settings
if (settings.method === 'GET') {
settings.contentType = 'application/json;charset=UTF-8';
} else if (settings.method === 'POST') {
settings.contentType = 'application/x-www-form-urlencoded';
} else {
for (var key in settings) {
if (Object.hasOwnProperty.call(settings, key) && options[key] !== undefined) {
settings[key] = options[key];
}
}
if (settings.method != 'GET' && settings.method != 'POST') {
console.warn('method: ', settings.method, 'is not valid.');

@@ -46,2 +49,10 @@ return false;

if (settings.contentType == undefined) {
if (settings.method === 'GET') {
settings.contentType = 'application/json;charset=UTF-8';
} else if (settings.method === 'POST') {
settings.contentType = 'application/x-www-form-urlencoded';
}
}
httpRequest.addEventListener("load", settings.load);

@@ -48,0 +59,0 @@ httpRequest.addEventListener("error", settings.error);

{
"name": "meteora",
"version": "0.0.5",
"version": "0.0.6",
"description": "A library of common javascript functions to make life easier.",

@@ -9,2 +9,6 @@ "main": "dist/index.js",

},
"repository": {
"type": "git",
"url": "git+https://github.com/meteora-digital/meteora.git"
},
"keywords": [

@@ -20,2 +24,5 @@ "library",

"license": "MIT",
"bugs": {
"url": "https://github.com/meteora-digital/meteora/issues"
},
"devDependencies": {

@@ -29,3 +36,4 @@ "@babel/core": "^7.10.2",

"gulp-plumber": "^1.2.1"
}
},
"homepage": "https://github.com/meteora-digital/meteora#readme"
}
# Meteora
### What is this?
A growing library of helper functions to help speed up development time, and / or avoid linking polyfills for older browsers.
### Functions:
#### ajax
This is a basic jQuery ajax replacement which can be used to make XHR requests.
```javascript
ajax
````
###### Note: The functions is subject to improve and change at any time, things may break if you update the package. Check back in the readme for code updates or feel free to report any issues.

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

function ajax(options) {
function ajax(options = {}) {
const httpRequest = new XMLHttpRequest();
const settings = Object.assign({
const settings = {
url: '/',

@@ -19,9 +19,12 @@ method: 'GET',

}
}, options);
};
if (settings.method === 'GET') {
settings.contentType = 'application/json;charset=UTF-8'
} else if (settings.method === 'POST') {
settings.contentType = 'application/x-www-form-urlencoded'
} else {
// Object assign the settings
for (const key in settings) {
if (Object.hasOwnProperty.call(settings, key) && options[key] !== undefined) {
settings[key] = options[key];
}
}
if (settings.method != 'GET' && settings.method != 'POST') {
console.warn('method: ', settings.method, 'is not valid.');

@@ -31,2 +34,10 @@ return false;

if (settings.contentType == undefined) {
if (settings.method === 'GET') {
settings.contentType = 'application/json;charset=UTF-8'
} else if (settings.method === 'POST') {
settings.contentType = 'application/x-www-form-urlencoded'
}
}
httpRequest.addEventListener("load", settings.load);

@@ -33,0 +44,0 @@ httpRequest.addEventListener("error", settings.error);

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc