Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
d43d1ba212 | |||
65e771f1ba | |||
5825a602ed | |||
5e961f7a5b | |||
36bcb9265a | |||
53bf2f3569 | |||
523ab7ee77 | |||
d60cc5430f |
@ -18,17 +18,6 @@ before_script:
|
|||||||
# ====================
|
# ====================
|
||||||
# security stage
|
# security stage
|
||||||
# ====================
|
# ====================
|
||||||
mirror:
|
|
||||||
stage: security
|
|
||||||
script:
|
|
||||||
- npmci git mirror
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
auditProductionDependencies:
|
auditProductionDependencies:
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
stage: security
|
stage: security
|
||||||
@ -122,11 +111,10 @@ trigger:
|
|||||||
pages:
|
pages:
|
||||||
stage: metadata
|
stage: metadata
|
||||||
script:
|
script:
|
||||||
- npmci node install lts
|
- npmci node install stable
|
||||||
- npmci command npm install -g @gitzone/tsdoc
|
|
||||||
- npmci npm prepare
|
- npmci npm prepare
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci command tsdoc
|
- npmci command npm run buildDocs
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
- lossless
|
||||||
- docker
|
- docker
|
||||||
|
15940
package-lock.json
generated
15940
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
17
package.json
17
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartstring",
|
"name": "@pushrocks/smartstring",
|
||||||
"version": "4.0.2",
|
"version": "4.0.6",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "handle strings in smart ways. TypeScript ready.",
|
"description": "handle strings in smart ways. TypeScript ready.",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
@ -8,7 +8,8 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/)",
|
"test": "(tstest test/)",
|
||||||
"build": "(tsbuild --web --allowimplicitany)"
|
"build": "(tsbuild --web --allowimplicitany)",
|
||||||
|
"buildDocs": "tsdoc"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -25,17 +26,17 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pushrocks/smartstring#readme",
|
"homepage": "https://gitlab.com/pushrocks/smartstring#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.61",
|
"@gitzone/tsbuild": "^2.1.65",
|
||||||
"@gitzone/tsrun": "^1.2.32",
|
"@gitzone/tsrun": "^1.2.37",
|
||||||
"@gitzone/tstest": "^1.0.69",
|
"@gitzone/tstest": "^1.0.73",
|
||||||
"@pushrocks/tapbundle": "^5.0.3",
|
"@pushrocks/tapbundle": "^5.0.4",
|
||||||
"@types/node": "^17.0.23",
|
"@types/node": "^18.7.17",
|
||||||
"tslint": "^6.1.3",
|
"tslint": "^6.1.3",
|
||||||
"tslint-config-prettier": "^1.18.0"
|
"tslint-config-prettier": "^1.18.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/isounique": "^1.0.5",
|
"@pushrocks/isounique": "^1.0.5",
|
||||||
"@pushrocks/smartenv": "^5.0.0",
|
"@pushrocks/smartenv": "^5.0.3",
|
||||||
"@types/randomatic": "^3.1.3",
|
"@types/randomatic": "^3.1.3",
|
||||||
"buffer": "^6.0.3",
|
"buffer": "^6.0.3",
|
||||||
"crypto-random-string": "^4.0.0",
|
"crypto-random-string": "^4.0.0",
|
||||||
|
@ -3,14 +3,21 @@ import { tap, expect } from '@pushrocks/tapbundle';
|
|||||||
|
|
||||||
// Base64
|
// Base64
|
||||||
let testBase64: smartstring.Base64;
|
let testBase64: smartstring.Base64;
|
||||||
|
|
||||||
tap.test('expect create a valid instance of Base64', async () => {
|
tap.test('expect create a valid instance of Base64', async () => {
|
||||||
testBase64 = new smartstring.Base64('somestring', 'string');
|
testBase64 = new smartstring.Base64('somestring', 'string');
|
||||||
expect(testBase64).toBeInstanceOf(smartstring.Base64);
|
expect(testBase64).toBeInstanceOf(smartstring.Base64);
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('expect read output a file as base64 and base64uri', async () => {
|
tap.test('expect read output a file as base64 and base64uri', async () => {
|
||||||
expect(testBase64.base64String).not.toEqual(testBase64.base64UriString);
|
expect(testBase64.base64String).not.toEqual(testBase64.base64UriString);
|
||||||
let testBase64_2 = new smartstring.Base64(testBase64.base64UriString, 'base64uri');
|
let testBase64_2 = new smartstring.Base64(testBase64.base64UriString, 'base64uri');
|
||||||
expect(testBase64_2.simpleString).toEqual(testBase64.simpleString);
|
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();
|
tap.start();
|
||||||
|
8
ts/00_commitinfo_data.ts
Normal file
8
ts/00_commitinfo_data.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* autocreated commitinfo by @pushrocks/commitinfo
|
||||||
|
*/
|
||||||
|
export const commitinfo = {
|
||||||
|
name: '@pushrocks/smartstring',
|
||||||
|
version: '4.0.6',
|
||||||
|
description: 'handle strings in smart ways. TypeScript ready.'
|
||||||
|
}
|
@ -3,14 +3,14 @@ import * as plugins from './smartstring.plugins.js';
|
|||||||
/**
|
/**
|
||||||
* the type for base 64
|
* the type for base 64
|
||||||
*/
|
*/
|
||||||
export type TBase64Input = 'string' | 'base64' | 'base64uri';
|
export type TStringInputType = 'string' | 'base64' | 'base64uri';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* handle base64 strings
|
* handle base64 strings
|
||||||
*/
|
*/
|
||||||
export class Base64 {
|
export class Base64 {
|
||||||
private refString: string;
|
private refString: string;
|
||||||
constructor(inputStringArg, typeArg: TBase64Input) {
|
constructor(inputStringArg, typeArg: TStringInputType) {
|
||||||
switch (typeArg) {
|
switch (typeArg) {
|
||||||
case 'string': // easiest case
|
case 'string': // easiest case
|
||||||
this.refString = inputStringArg;
|
this.refString = inputStringArg;
|
||||||
@ -66,4 +66,14 @@ export let base64 = {
|
|||||||
decode: (stringArg: string) => {
|
decode: (stringArg: string) => {
|
||||||
return plugins.jsBase64.decode(stringArg);
|
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);
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
@ -26,7 +26,7 @@ export class GitRepo {
|
|||||||
* ---------------------------------------------- */
|
* ---------------------------------------------- */
|
||||||
const gitRegex = function (stringArg: string) {
|
const gitRegex = function (stringArg: string) {
|
||||||
const regexString =
|
const regexString =
|
||||||
/([a-zA-Z0-9\-\.]*)(?:\/|\:)([a-zA-Z0-9\-\.]*)(?:\/)([a-zA-Z0-9\-\.]*)(?:\.git)/;
|
/([a-zA-Z0-9\-_\.]*)(?:\/|\:)([a-zA-Z0-9\-_\.]*)(?:\/)([a-zA-Z0-9\-_\.]*)(?:\.git)/;
|
||||||
let regexMatches = regexString.exec(stringArg);
|
let regexMatches = regexString.exec(stringArg);
|
||||||
return regexMatches;
|
return regexMatches;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user