fix(core): update

This commit is contained in:
Philipp Kunz 2022-09-13 19:23:11 +02:00
parent 36bcb9265a
commit 5e961f7a5b
5 changed files with 23 additions and 17 deletions

View File

@ -18,17 +18,6 @@ before_script:
# ====================
# security stage
# ====================
mirror:
stage: security
script:
- npmci git mirror
only:
- tags
tags:
- lossless
- docker
- notpriv
auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
@ -122,11 +111,10 @@ trigger:
pages:
stage: metadata
script:
- npmci node install lts
- npmci command npm install -g @gitzone/tsdoc
- npmci node install stable
- npmci npm prepare
- npmci npm install
- npmci command tsdoc
- npmci command npm run buildDocs
tags:
- lossless
- docker

View File

@ -8,7 +8,8 @@
"type": "module",
"scripts": {
"test": "(tstest test/)",
"build": "(tsbuild --web --allowimplicitany)"
"build": "(tsbuild --web --allowimplicitany)",
"buildDocs": "tsdoc"
},
"repository": {
"type": "git",
@ -60,4 +61,4 @@
"browserslist": [
"last 1 chrome versions"
]
}
}

View File

@ -3,14 +3,21 @@ import { tap, expect } from '@pushrocks/tapbundle';
// Base64
let testBase64: smartstring.Base64;
tap.test('expect create a valid instance of Base64', async () => {
testBase64 = new smartstring.Base64('somestring', 'string');
expect(testBase64).toBeInstanceOf(smartstring.Base64);
});
tap.test('expect read output a file as base64 and base64uri', async () => {
expect(testBase64.base64String).not.toEqual(testBase64.base64UriString);
let testBase64_2 = new smartstring.Base64(testBase64.base64UriString, 'base64uri');
expect(testBase64_2.simpleString).toEqual(testBase64.simpleString);
});
tap.test('should test for a valid base64 token', async () => {
const result = smartstring.base64.isBase64('dGVzdA==');
expect(result).toBeTrue();
});
tap.start();

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@pushrocks/smartstring',
version: '4.0.4',
version: '4.0.5',
description: 'handle strings in smart ways. TypeScript ready.'
}

View File

@ -66,4 +66,14 @@ export let base64 = {
decode: (stringArg: string) => {
return plugins.jsBase64.decode(stringArg);
},
/**
*
* @param stringArg
* checks wether the string is base64 encoded
*/
isBase64: (stringArg: string) => {
const regex = /^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?$/;
return regex.test(stringArg);
},
};