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

microtaskjs

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

microtaskjs - npm Package Compare versions

Comparing version
1.1.1
to
1.1.2
+21
LICENSE
MIT License
Copyright (c) 2023 Arjun059
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+2
-1
{
"name": "microtaskjs",
"version": "1.1.1",
"version": "1.1.2",
"description": "",

@@ -13,4 +13,5 @@ "main": "index.js",

},
"keywords": ["microtaskjs", "microtask-quie","nodejs", "javascript promise"],
"author": "arjun",
"license": "MIT"
}
+48
-58

@@ -1,84 +0,74 @@

// let events = require('events')
// const eventEmitter = new events.EventEmitter();
# MicrotaskJs
## microtaskJs enable you to use microtask-queu in node js .
const MicroTask = require("./microtask")
const DB = {
findUser : () => {
return new Promise((next) => {
setTimeout(() => {
next({id: 1, name: "DJ"})
}, 2000)
})
},
findProducts : () => {
return new Promise((next) => {
setTimeout(() => {
next([{name: "Flower"}, {name: "Benten Watch"}, {name: "Cool Shoes"}])
}, 3000)
})
},
findPosts: () => {
return new Promise((next) => {
setTimeout(() => {
next([{title: 'Hello Minni' }, {title: "Hello Piggi"}, {title: "Hello Gimmi"}])
}, 3000)
})
}
}
[![Build Status](https://travis-ci.org/joemccann/dillinger.svg?branch=master)](https://github.com/Arjun059/)
function Asynctask() {
return new Promise(async (next) => {
Microtask js add your promise in microtask-queu. this Lib Execute your promise concurrently manner.
more better way to use promise with then method. Fast Code Better Performace.
Benefit of concurrently programing
let tasks = 3
let { data, event, error } = MicroTask(tasks);
DB.findUser().then((data) => event.emit("done", {user: data}))
DB.findProducts().then((data) => event.emit("done", {products: data}))
DB.findPosts().then((data) => event.emit("done", {posts: data}))
## Features
data.then((data) => {
- Serialization of then method
- Run many task at a time. Benifit of concurrently programing.
- Handling Error Gressfully
- Small Plugin just few line of code
console.log(data, "async call");
next(data)
###### MicrotaskJs is a lightweight Plugin Just few line of code.
})
})
## Installation
}
MicrotaskJs requires [Node.js](https://nodejs.org/) v4+ to run.
Install the dependencies and devDependencies and start the server.
```
npm i microtaskjs
```
      or
```
yarn add microtaskjs
```
async function SyncTask() {
return new Promise(async (next) => {
let user = await DB.findUser()
let products = await DB.findProducts()
let posts = await DB.findPosts();
## Usage
Dillinger is currently extended with the following plugins.
Instructions on how to use them in your own application are linked below.
```
const Microtask = require("microtaskjs");
console.log({user, products, posts}, 'sync call')
next({user, products, posts});
function Asynctask() {
return new Promise(async (next) => {
let tasks = 3 // total tasks
let { data, event, error } = new MicroTask(tasks);
// data a promies , errror if error occur, event pass data to the event
DB.findUser().then((data) => { // use then for promise
event.emit("done", {user: data})
})
DB.findProducts().then((data) => event.emit("done", {products: data}))
DB.findPosts().then((data) => event.emit("done", {posts: data}))
data.then((data) => {
next(data)
})
})
}
(async () => {
```
## Development
console.time("timer1")
let newdata = await Asynctask()
console.timeEnd("timer1")
Want to contribute? Great!
[github](https://github.com/Arjun059/MicrotaskJs) Account Feel Free To Connect
console.time("timer2")
let data = await SyncTask();
console.timeEnd("timer2")
## License
})()
MIT
**Free Software**