New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

easy-loop

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

easy-loop

Easy sync loop processing for Node.js

  • 1.0.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
109
increased by14.74%
Maintainers
1
Weekly downloads
 
Created
Source

easy-loop

쉬운 동기식 반복 처리:)

Comment

1) Method
	: 모두 같은 동작이며 편리한 메소드를 호출하세요.(All same)
	
	var loop = require('easy-loop');
	loop(arg1, arg2[, arg3]) == loop.for() == loop.while() == loop.loop()
	
2) Arguments	
	(1) Array or Object 	- require
	(2) process function 	- require
	(3) callback function 	- option

Examples

var loop = require('easy-loop');

var arr = [1,2,3,4,5];
console.log("Case1 Start => Array");
loop(arr, function(key, value, next){
	console.log(key, "=>", value);
	next();	//require
}, function(err){
	console.log("err : ", err);
	console.log("Case 1 result");
});
console.log("Case1 End => Array\n");

/* 결과(Result)
Case1 Start => Array
0 '=>' 1
1 '=>' 2
2 '=>' 3
3 '=>' 4
4 '=>' 5
err :  undefined
Case 1 result
Case1 End => Array
*/


arr = [1,2,3,4,5];
console.log("Case2 Start => Array and 2 arguments");
loop.for(arr, function(key, value, next){
	console.log(key, "=>", value);
	next();
});
console.log("Case2 End => Array and 2 arguments\n");

/* 결과(Result)
Case2 Start => Array and 2 arguments
0 '=>' 1
1 '=>' 2
2 '=>' 3
3 '=>' 4
4 '=>' 5
Case2 End => Array and 2 arguments
*/


arr = [1,2,3,4,5];
console.log("Case3 Start => Array and error(or break)");
loop.while(arr, function(key, value, next){
	console.log(key, "=>", value);
	if(key === 2)	next("error or break");
	else			next();
}, function(err){
	console.log("err : ", err);
	console.log("Case 3 result");
});
console.log("Case3 End => Array and error(or break)\n");

/* 결과(Result)
Case3 Start => Array and error(or break)
0 '=>' 1
1 '=>' 2
2 '=>' 3
err :  error or break
Case 3 result
Case3 End => Array and error(or break)
*/


var obj = {a:1,b:2,c:3,d:4,e:5};
console.log("Case4 Start => object");
loop.loop(obj, function(key, value, next){
	console.log(key, "=>", value);
	next();
}, function(err){
	console.log("err : ", err);
	console.log("Case 4 result");
});
console.log("Case4 End => object\n");

/* 결과(Result)
Case4 Start => object
a => 1
b => 2
c => 3
d => 4
e => 5
err :  undefined
Case 4 result
Case4 End => object
*/

Keywords

FAQs

Package last updated on 18 Jan 2016

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

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