fix(core): update
This commit is contained in:
		@@ -19,23 +19,36 @@ mirror:
 | 
				
			|||||||
  stage: security
 | 
					  stage: security
 | 
				
			||||||
  script:
 | 
					  script:
 | 
				
			||||||
    - npmci git mirror
 | 
					    - npmci git mirror
 | 
				
			||||||
 | 
					  only:
 | 
				
			||||||
 | 
					    - tags
 | 
				
			||||||
  tags:
 | 
					  tags:
 | 
				
			||||||
    - lossless
 | 
					    - lossless
 | 
				
			||||||
    - docker
 | 
					    - docker
 | 
				
			||||||
    - notpriv
 | 
					    - notpriv
 | 
				
			||||||
 | 
					
 | 
				
			||||||
audit:
 | 
					auditProductionDependencies:
 | 
				
			||||||
 | 
					  image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
 | 
				
			||||||
 | 
					  stage: security
 | 
				
			||||||
 | 
					  script:
 | 
				
			||||||
 | 
					    - npmci npm prepare
 | 
				
			||||||
 | 
					    - npmci command npm install --production --ignore-scripts
 | 
				
			||||||
 | 
					    - npmci command npm config set registry https://registry.npmjs.org
 | 
				
			||||||
 | 
					    - npmci command npm audit --audit-level=high --only=prod --production
 | 
				
			||||||
 | 
					  tags:
 | 
				
			||||||
 | 
					    - docker
 | 
				
			||||||
 | 
					  allow_failure: true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					auditDevDependencies:
 | 
				
			||||||
  image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
 | 
					  image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
 | 
				
			||||||
  stage: security
 | 
					  stage: security
 | 
				
			||||||
  script:
 | 
					  script:
 | 
				
			||||||
    - npmci npm prepare
 | 
					    - npmci npm prepare
 | 
				
			||||||
    - npmci command npm install --ignore-scripts
 | 
					    - npmci command npm install --ignore-scripts
 | 
				
			||||||
    - npmci command npm config set registry https://registry.npmjs.org
 | 
					    - npmci command npm config set registry https://registry.npmjs.org
 | 
				
			||||||
    - npmci command npm audit --audit-level=high
 | 
					    - npmci command npm audit --audit-level=high --only=dev
 | 
				
			||||||
  tags:
 | 
					  tags:
 | 
				
			||||||
    - lossless
 | 
					 | 
				
			||||||
    - docker
 | 
					    - docker
 | 
				
			||||||
    - notpriv
 | 
					  allow_failure: true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# ====================
 | 
					# ====================
 | 
				
			||||||
# test stage
 | 
					# test stage
 | 
				
			||||||
@@ -50,9 +63,7 @@ testStable:
 | 
				
			|||||||
    - npmci npm test
 | 
					    - npmci npm test
 | 
				
			||||||
  coverage: /\d+.?\d+?\%\s*coverage/
 | 
					  coverage: /\d+.?\d+?\%\s*coverage/
 | 
				
			||||||
  tags:
 | 
					  tags:
 | 
				
			||||||
    - lossless
 | 
					 | 
				
			||||||
    - docker
 | 
					    - docker
 | 
				
			||||||
    - priv
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
testBuild:
 | 
					testBuild:
 | 
				
			||||||
  stage: test
 | 
					  stage: test
 | 
				
			||||||
@@ -63,9 +74,7 @@ testBuild:
 | 
				
			|||||||
    - npmci command npm run build
 | 
					    - npmci command npm run build
 | 
				
			||||||
  coverage: /\d+.?\d+?\%\s*coverage/
 | 
					  coverage: /\d+.?\d+?\%\s*coverage/
 | 
				
			||||||
  tags:
 | 
					  tags:
 | 
				
			||||||
    - lossless
 | 
					 | 
				
			||||||
    - docker
 | 
					    - docker
 | 
				
			||||||
    - notpriv
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
release:
 | 
					release:
 | 
				
			||||||
  stage: release
 | 
					  stage: release
 | 
				
			||||||
@@ -85,6 +94,8 @@ release:
 | 
				
			|||||||
codequality:
 | 
					codequality:
 | 
				
			||||||
  stage: metadata
 | 
					  stage: metadata
 | 
				
			||||||
  allow_failure: true
 | 
					  allow_failure: true
 | 
				
			||||||
 | 
					  only:
 | 
				
			||||||
 | 
					    - tags
 | 
				
			||||||
  script:
 | 
					  script:
 | 
				
			||||||
    - npmci command npm install -g tslint typescript
 | 
					    - npmci command npm install -g tslint typescript
 | 
				
			||||||
    - npmci npm prepare
 | 
					    - npmci npm prepare
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								.vscode/settings.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.vscode/settings.json
									
									
									
									
										vendored
									
									
								
							@@ -15,7 +15,7 @@
 | 
				
			|||||||
            "properties": {
 | 
					            "properties": {
 | 
				
			||||||
              "projectType": {
 | 
					              "projectType": {
 | 
				
			||||||
                "type": "string",
 | 
					                "type": "string",
 | 
				
			||||||
                "enum": ["website", "element", "service", "npm"]
 | 
					                "enum": ["website", "element", "service", "npm", "wcc"]
 | 
				
			||||||
              }
 | 
					              }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -43,5 +43,8 @@
 | 
				
			|||||||
    "cli.js",
 | 
					    "cli.js",
 | 
				
			||||||
    "npmextra.json",
 | 
					    "npmextra.json",
 | 
				
			||||||
    "readme.md"
 | 
					    "readme.md"
 | 
				
			||||||
 | 
					  ],
 | 
				
			||||||
 | 
					  "browserslist": [
 | 
				
			||||||
 | 
					    "last 1 chrome versions"
 | 
				
			||||||
  ]
 | 
					  ]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
							
								
								
									
										21
									
								
								readme.md
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								readme.md
									
									
									
									
									
								
							@@ -8,13 +8,20 @@ timeouts for the async/await era, written in TypeScript
 | 
				
			|||||||
* [docs (typedoc)](https://pushrocks.gitlab.io/smartdelay/)
 | 
					* [docs (typedoc)](https://pushrocks.gitlab.io/smartdelay/)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Status for master
 | 
					## Status for master
 | 
				
			||||||
[](https://gitlab.com/pushrocks/smartdelay/commits/master)
 | 
					
 | 
				
			||||||
[](https://gitlab.com/pushrocks/smartdelay/commits/master)
 | 
					Status Category | Status Badge
 | 
				
			||||||
[](https://www.npmjs.com/package/@pushrocks/smartdelay)
 | 
					-- | --
 | 
				
			||||||
[](https://snyk.io/test/npm/@pushrocks/smartdelay)
 | 
					GitLab Pipelines | [](https://lossless.cloud)
 | 
				
			||||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
 | 
					GitLab Pipline Test Coverage | [](https://lossless.cloud)
 | 
				
			||||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
 | 
					npm | [](https://lossless.cloud)
 | 
				
			||||||
[](https://prettier.io/)
 | 
					Snyk | [](https://lossless.cloud)
 | 
				
			||||||
 | 
					TypeScript Support | [](https://lossless.cloud)
 | 
				
			||||||
 | 
					node Support | [](https://nodejs.org/dist/latest-v10.x/docs/api/)
 | 
				
			||||||
 | 
					Code Style | [](https://lossless.cloud)
 | 
				
			||||||
 | 
					PackagePhobia (total standalone install weight) | [](https://lossless.cloud)
 | 
				
			||||||
 | 
					PackagePhobia (package size on registry) | [](https://lossless.cloud)
 | 
				
			||||||
 | 
					BundlePhobia (total size when bundled) | [](https://lossless.cloud)
 | 
				
			||||||
 | 
					Platform support | [](https://lossless.cloud) [](https://lossless.cloud)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Usage
 | 
					## Usage
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										10
									
								
								test/test.ts
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								test/test.ts
									
									
									
									
									
								
							@@ -2,7 +2,7 @@ import { expect, tap } from '@pushrocks/tapbundle';
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import * as smartdelay from '../ts/index';
 | 
					import * as smartdelay from '../ts/index';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
tap.test('.delayFor should delay async', async tools => {
 | 
					tap.test('.delayFor should delay async', async (tools) => {
 | 
				
			||||||
  tools.timeout(5000);
 | 
					  tools.timeout(5000);
 | 
				
			||||||
  let timePassed = false;
 | 
					  let timePassed = false;
 | 
				
			||||||
  setTimeout(() => {
 | 
					  setTimeout(() => {
 | 
				
			||||||
@@ -14,7 +14,7 @@ tap.test('.delayFor should delay async', async tools => {
 | 
				
			|||||||
  });
 | 
					  });
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
tap.test('.delayForRandom should delay async for a random time period', async tools => {
 | 
					tap.test('.delayForRandom should delay async for a random time period', async (tools) => {
 | 
				
			||||||
  let timePassedBefore = false;
 | 
					  let timePassedBefore = false;
 | 
				
			||||||
  let timePassedAfter = false;
 | 
					  let timePassedAfter = false;
 | 
				
			||||||
  setTimeout(() => {
 | 
					  setTimeout(() => {
 | 
				
			||||||
@@ -28,14 +28,14 @@ tap.test('.delayForRandom should delay async for a random time period', async to
 | 
				
			|||||||
  expect(timePassedAfter).to.be.false;
 | 
					  expect(timePassedAfter).to.be.false;
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
tap.test('.delayFor should pass on a type', async tools => {
 | 
					tap.test('.delayFor should pass on a type', async (tools) => {
 | 
				
			||||||
  tools.timeout(5000);
 | 
					  tools.timeout(5000);
 | 
				
			||||||
  let timePassed = false;
 | 
					  let timePassed = false;
 | 
				
			||||||
  setTimeout(() => {
 | 
					  setTimeout(() => {
 | 
				
			||||||
    timePassed = true;
 | 
					    timePassed = true;
 | 
				
			||||||
  }, 2000);
 | 
					  }, 2000);
 | 
				
			||||||
  let hey = 'heyThere';
 | 
					  let hey = 'heyThere';
 | 
				
			||||||
  await smartdelay.delayFor<string>(3000, hey).then(async stringArg => {
 | 
					  await smartdelay.delayFor<string>(3000, hey).then(async (stringArg) => {
 | 
				
			||||||
    expect(stringArg).equal('heyThere');
 | 
					    expect(stringArg).equal('heyThere');
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
@@ -45,7 +45,7 @@ tap.test('smartdelay.Timeout', async () => {
 | 
				
			|||||||
  await timeout.promise;
 | 
					  await timeout.promise;
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
tap.test('smartdelay.Timeout should cancel', async tools => {
 | 
					tap.test('smartdelay.Timeout should cancel', async (tools) => {
 | 
				
			||||||
  let timeout = new smartdelay.Timeout(60000);
 | 
					  let timeout = new smartdelay.Timeout(60000);
 | 
				
			||||||
  timeout.cancel();
 | 
					  timeout.cancel();
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										12
									
								
								ts/index.ts
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								ts/index.ts
									
									
									
									
									
								
							@@ -5,7 +5,11 @@ import * as smartpromise from '@pushrocks/smartpromise';
 | 
				
			|||||||
 * @param timeInMillisecondArg
 | 
					 * @param timeInMillisecondArg
 | 
				
			||||||
 * @param passOnArg
 | 
					 * @param passOnArg
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
export let delayFor = async <T>(timeInMillisecondArg: number, passOnArg?: T, unrefedArg = false) => {
 | 
					export let delayFor = async <T>(
 | 
				
			||||||
 | 
					  timeInMillisecondArg: number,
 | 
				
			||||||
 | 
					  passOnArg?: T,
 | 
				
			||||||
 | 
					  unrefedArg = false
 | 
				
			||||||
 | 
					) => {
 | 
				
			||||||
  const timeout = new Timeout(timeInMillisecondArg, null, unrefedArg);
 | 
					  const timeout = new Timeout(timeInMillisecondArg, null, unrefedArg);
 | 
				
			||||||
  await timeout.promise;
 | 
					  await timeout.promise;
 | 
				
			||||||
  return passOnArg;
 | 
					  return passOnArg;
 | 
				
			||||||
@@ -20,7 +24,11 @@ export let delayForRandom = async <T>(
 | 
				
			|||||||
  passOnArg?: T,
 | 
					  passOnArg?: T,
 | 
				
			||||||
  unrefedArg = false
 | 
					  unrefedArg = false
 | 
				
			||||||
) => {
 | 
					) => {
 | 
				
			||||||
  await delayFor(Math.random() * (timeMaxInMillisecondArg - timeMinInMillisecondArg) + timeMinInMillisecondArg, null, unrefedArg)
 | 
					  await delayFor(
 | 
				
			||||||
 | 
					    Math.random() * (timeMaxInMillisecondArg - timeMinInMillisecondArg) + timeMinInMillisecondArg,
 | 
				
			||||||
 | 
					    null,
 | 
				
			||||||
 | 
					    unrefedArg
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
  return passOnArg;
 | 
					  return passOnArg;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user