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

aleppo

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aleppo - npm Package Compare versions

Comparing version 1.0.0-rc.1 to 1.1.0

test/ee.json

4

index.js

@@ -22,1 +22,5 @@ export { default as generators } from './src/generators';

} from './src/has';
export {
wait,
} from './src/wait';
{
"name": "aleppo",
"version": "1.0.0-rc.1",
"version": "1.1.0",
"description": "General node functions, useful for any project.",

@@ -10,4 +10,3 @@ "main": "index.js",

"scripts": {
"test": "mocha --compilers js:babel-core/register test",
"test-delay": "mocha --compilers js:babel-core/register test/getters.delay.test.js"
"test": "mocha --compilers js:babel-core/register test"
},

@@ -18,2 +17,18 @@ "repository": {

},
"keywords": [
"javascript-tools",
"javascript",
"nodejs",
"node",
"node-js",
"nodejs-modules",
"node-modules",
"functions",
"random",
"boolean",
"delay",
"date",
"promose",
"then"
],
"author": "'Jalal <'jimmy002020@gmail.com'>",

@@ -30,2 +45,3 @@ "license": "MIT",

"chai": "3.5.0",
"chai-as-promised": "6.0.0",
"eslint": "3.19.0",

@@ -35,3 +51,6 @@ "eslint-config-airbnb-base": "11.1.3",

"mocha": "3.3.0"
},
"dependencies": {
"bluebird": "3.5.0"
}
}

@@ -58,3 +58,3 @@ # Overview

```
2. **dealy**:
2. **delay**:
```javascript

@@ -75,2 +75,8 @@ getters.delay(option) // returns delay time in microsecondsm according to given option.

# wait:
```javascript
wait(option).then(() => console.log('Hello!')) // returns promise.
// wait('20s').then(() => console.log('Hello!')); // 'Hello! will be printed after 20 seconds'
```
* options allowed in wait are the same in delay function.

@@ -77,0 +83,0 @@ # Tests

@@ -11,2 +11,8 @@ import {

import { isValid } from '../../is';
const err = (opt) => {
throw new Error(`Ops! Cannot recognize option format: ${opt}`);
};
/**

@@ -60,3 +66,3 @@ * Calculate time duration accourding to given time format.

default:
throw new Error(`Ops! Cannot recognize option format: ${opt}`);
return err(val);
}

@@ -66,6 +72,12 @@ };

const delay = (val) => {
const valArray = val.split(/(\d+)/);
return get(parseInt(valArray[1].trim(), 10), valArray[2].trim().toLowerCase());
if (isValid(val)) {
const valArray = val.split(/(\d+)/);
return get(
isValid(valArray[1]) && parseInt(valArray[1].trim(), 10),
isValid(valArray[2]) && valArray[2].trim().toLowerCase(),
);
}
return err(val);
};
export default delay;

8

src/getters/object/obj.js
import { isUn, isNull } from '../../is';
const err = (objParam) => {
throw new Error(` Please, enter valid object parameter [${objParam}]`);
};
/*

@@ -7,6 +11,2 @@ * returns key and prop from given parameter.

*/
const err = (objParam) => {
throw new Error(` Please, enter valid object parameter [${objParam}]`);
};
const obj = (objParam) => {

@@ -13,0 +13,0 @@ const key = Object.keys(objParam)[0];

@@ -1,8 +0,12 @@

import { Promise } from './modules';
import getDelayDuration from './getDelayDuration';
import Promise from './modules';
import getters from '../getters';
const wait = time => new Promise(resolve => setTimeout(resolve, getDelayDuration(time)));
const wait = time => new Promise((resolve, reject) => {
try {
setTimeout(resolve, getters.delay(time));
} catch (e) {
reject(e);
}
});
export default wait;
// wait(30, 's').then(() => console.log('Hello!')); // 'Hello! will be printed after 30 seconds'
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