New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

peprze

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

peprze

A simple Promise shim and functionality extension

latest
Source
npmnpm
Version
1.5.43
Version published
Maintainers
1
Created
Source

Peprze

Promise shim and functionality extender

NPM version

Table of contents

What is it?

This library allows to use promises in older browsers as well as add extra functionality to promises that allows promise functionality in the kaleo library set

Installation

This libray can be installed using:

  • NPM : npm install peprze --save
  • Bower : bower install peprze --save
  • Yarn : yarn add peprze

Getting started

The script can be loaded both in the head and in the body. All functionality is automatically loaded as soon as the file is loaded. Note: include this script before any other scripts for proper implementation

 <script src="/(node_modules|bower_modules)/peprze/peprze.min.js"></script>

To start using it is as simple as instancing a new promise in the same way as native promises

 var test = new Promise(function(resolve, reject){
  /* Do async here */
 })

Examples

Fetching files

Using Xhr to fetch files using promises

function fetchfile(url) {
  var xhr = new XMLHttpRequest();
  xhr.open('GET', url, true);
  
  return new Promise(function(resolve, reject){
    xhr.onreadystatechange = function() {
      if(xhr.readyState === 4) {
        if(xhr.status === 200) {
          resolve(xhr.responseText);
        }
        else {
          reject(new Error(xhr.status));
        }
      }
    }
    
    xhr.send();
  });
}

How to contribute

If You would like to contribute here are the steps

  • Clone Repo: Peprze Github Repo
  • Install any necessary dev dependencies
  • build the project npm run build
  • test your changes don't break anything npm test
  • Make a pull request on github for your changes :)

License

You can view the license here: License

FAQs

Package last updated on 25 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts