Compare commits
97 Commits
Author | SHA1 | Date | |
---|---|---|---|
6a7570de7b | |||
579e25fe5a | |||
871a22a801 | |||
aacb4a6873 | |||
0ef1af7b86 | |||
2af0329918 | |||
b65a460ef2 | |||
3f5b0ebe1e | |||
6f2cedc1dd | |||
2c29ae3bf0 | |||
b26b8ed4a6 | |||
0e6877d2d1 | |||
8a0c3fe906 | |||
ae861fa271 | |||
3e78466e5f | |||
eea19bcd89 | |||
1fc95fcf0e | |||
14ba4465d9 | |||
707e31d517 | |||
64d85e711a | |||
34a5cc9862 | |||
d43d1ba212 | |||
65e771f1ba | |||
5825a602ed | |||
5e961f7a5b | |||
36bcb9265a | |||
53bf2f3569 | |||
523ab7ee77 | |||
d60cc5430f | |||
c0035bb4f3 | |||
976f81420f | |||
1be144d099 | |||
9d4b7a5292 | |||
563d6f0ac3 | |||
4da0aeb871 | |||
931defe98a | |||
1e6077ce34 | |||
8b1769d65e | |||
48878c0b38 | |||
76cfc8bec0 | |||
7f3118c525 | |||
9d189d1b59 | |||
0266afca8e | |||
bef836fc83 | |||
2bd1741893 | |||
bd20512b10 | |||
25d0ba8036 | |||
c517652122 | |||
bf3e640307 | |||
08cb2392fa | |||
4e1fa4efab | |||
26d00bb9d3 | |||
fd27ed1a56 | |||
1f31fe9dc5 | |||
bd7888f7ce | |||
201812e182 | |||
8dfa3f8965 | |||
43d50b746b | |||
a1ee8f37d6 | |||
8d9c75e113 | |||
8ff2a9d64a | |||
8665464416 | |||
e773644256 | |||
71fd0e614c | |||
55a5948a51 | |||
979375f08d | |||
95d5c6ceee | |||
c92ece79ff | |||
7c625c4390 | |||
65fc64f6aa | |||
8cda8c55c0 | |||
ec0b82de00 | |||
5e69664f59 | |||
f5838f6d6a | |||
fb4a03ad37 | |||
ceb6962a1c | |||
ffe757d820 | |||
60eb4b6b6e | |||
f73d394d35 | |||
212f41e00b | |||
59847dd287 | |||
7fa2fb1e74 | |||
355f7442ca | |||
88af0ab9aa | |||
5b5bcd804f | |||
8c894ea1c1 | |||
62336aa2cf | |||
e9899e5451 | |||
235f380139 | |||
4a94ce3038 | |||
7c4c787539 | |||
714e3a162c | |||
099bf9b270 | |||
83279a9c19 | |||
55d679e5ee | |||
974bf90703 | |||
93029d1aae |
66
.gitea/workflows/default_nottags.yaml
Normal file
66
.gitea/workflows/default_nottags.yaml
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
name: Default (not tags)
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags-ignore:
|
||||||
|
- '**'
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
|
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
|
||||||
|
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
||||||
|
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
||||||
|
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
||||||
|
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
security:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
continue-on-error: true
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install pnpm and npmci
|
||||||
|
run: |
|
||||||
|
pnpm install -g pnpm
|
||||||
|
pnpm install -g @shipzone/npmci
|
||||||
|
|
||||||
|
- name: Run npm prepare
|
||||||
|
run: npmci npm prepare
|
||||||
|
|
||||||
|
- name: Audit production dependencies
|
||||||
|
run: |
|
||||||
|
npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
npmci command pnpm audit --audit-level=high --prod
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
- name: Audit development dependencies
|
||||||
|
run: |
|
||||||
|
npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
npmci command pnpm audit --audit-level=high --dev
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
test:
|
||||||
|
if: ${{ always() }}
|
||||||
|
needs: security
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Test stable
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm install
|
||||||
|
npmci npm test
|
||||||
|
|
||||||
|
- name: Test build
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm install
|
||||||
|
npmci npm build
|
124
.gitea/workflows/default_tags.yaml
Normal file
124
.gitea/workflows/default_tags.yaml
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
name: Default (tags)
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
|
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
|
||||||
|
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
||||||
|
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
||||||
|
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
||||||
|
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
security:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
continue-on-error: true
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
run: |
|
||||||
|
pnpm install -g pnpm
|
||||||
|
pnpm install -g @shipzone/npmci
|
||||||
|
npmci npm prepare
|
||||||
|
|
||||||
|
- name: Audit production dependencies
|
||||||
|
run: |
|
||||||
|
npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
npmci command pnpm audit --audit-level=high --prod
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
- name: Audit development dependencies
|
||||||
|
run: |
|
||||||
|
npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
npmci command pnpm audit --audit-level=high --dev
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
test:
|
||||||
|
if: ${{ always() }}
|
||||||
|
needs: security
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
run: |
|
||||||
|
pnpm install -g pnpm
|
||||||
|
pnpm install -g @shipzone/npmci
|
||||||
|
npmci npm prepare
|
||||||
|
|
||||||
|
- name: Test stable
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm install
|
||||||
|
npmci npm test
|
||||||
|
|
||||||
|
- name: Test build
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm install
|
||||||
|
npmci npm build
|
||||||
|
|
||||||
|
release:
|
||||||
|
needs: test
|
||||||
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
run: |
|
||||||
|
pnpm install -g pnpm
|
||||||
|
pnpm install -g @shipzone/npmci
|
||||||
|
npmci npm prepare
|
||||||
|
|
||||||
|
- name: Release
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm publish
|
||||||
|
|
||||||
|
metadata:
|
||||||
|
needs: test
|
||||||
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
run: |
|
||||||
|
pnpm install -g pnpm
|
||||||
|
pnpm install -g @shipzone/npmci
|
||||||
|
npmci npm prepare
|
||||||
|
|
||||||
|
- name: Code quality
|
||||||
|
run: |
|
||||||
|
npmci command npm install -g typescript
|
||||||
|
npmci npm install
|
||||||
|
|
||||||
|
- name: Trigger
|
||||||
|
run: npmci trigger
|
||||||
|
|
||||||
|
- name: Build docs and upload artifacts
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm install
|
||||||
|
pnpm install -g @git.zone/tsdoc
|
||||||
|
npmci command tsdoc
|
||||||
|
continue-on-error: true
|
18
.gitignore
vendored
18
.gitignore
vendored
@ -1,4 +1,20 @@
|
|||||||
|
.nogit/
|
||||||
|
|
||||||
|
# artifacts
|
||||||
coverage/
|
coverage/
|
||||||
pages/
|
|
||||||
public/
|
public/
|
||||||
|
pages/
|
||||||
|
|
||||||
|
# installs
|
||||||
node_modules/
|
node_modules/
|
||||||
|
|
||||||
|
# caches
|
||||||
|
.yarn/
|
||||||
|
.cache/
|
||||||
|
.rpt2_cache
|
||||||
|
|
||||||
|
# builds
|
||||||
|
dist/
|
||||||
|
dist_*/
|
||||||
|
|
||||||
|
# custom
|
@ -1,59 +0,0 @@
|
|||||||
image: hosttoday/ht-docker-node:npmts
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- test
|
|
||||||
- release
|
|
||||||
- trigger
|
|
||||||
- pages
|
|
||||||
|
|
||||||
testLEGACY:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci test legacy
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
allow_failure: true
|
|
||||||
|
|
||||||
testLTS:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci test lts
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
testSTABLE:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci test stable
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
release:
|
|
||||||
stage: release
|
|
||||||
script:
|
|
||||||
- npmci publish
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
stage: trigger
|
|
||||||
script:
|
|
||||||
- npmci trigger
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
pages:
|
|
||||||
image: hosttoday/ht-docker-node:npmpage
|
|
||||||
stage: pages
|
|
||||||
script:
|
|
||||||
- npmci command npmpage --host gitlab
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
artifacts:
|
|
||||||
expire_in: 1 week
|
|
||||||
paths:
|
|
||||||
- public
|
|
11
.vscode/launch.json
vendored
Normal file
11
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"command": "npm test",
|
||||||
|
"name": "Run npm test",
|
||||||
|
"request": "launch",
|
||||||
|
"type": "node-terminal"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
26
.vscode/settings.json
vendored
Normal file
26
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"json.schemas": [
|
||||||
|
{
|
||||||
|
"fileMatch": ["/npmextra.json"],
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"npmci": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "settings for npmci"
|
||||||
|
},
|
||||||
|
"gitzone": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "settings for gitzone",
|
||||||
|
"properties": {
|
||||||
|
"projectType": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": ["website", "element", "service", "npm", "wcc"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
61
README.md
61
README.md
@ -1,61 +0,0 @@
|
|||||||
# smartstring
|
|
||||||
handle strings in smart ways. TypeScript ready.
|
|
||||||
|
|
||||||
## Availabililty
|
|
||||||
[](https://www.npmjs.com/package/smartstring)
|
|
||||||
[](https://gitlab.com/pushrocks/smartstring)
|
|
||||||
[](https://github.com/pushrocks/smartstring)
|
|
||||||
[](https://pushrocks.gitlab.io/smartstring/)
|
|
||||||
|
|
||||||
## Status for master
|
|
||||||
[](https://gitlab.com/pushrocks/smartstring/commits/master)
|
|
||||||
[](https://gitlab.com/pushrocks/smartstring/commits/master)
|
|
||||||
[](https://david-dm.org/pushrocks/smartstring)
|
|
||||||
[](https://www.bithound.io/github/pushrocks/smartstring/master/dependencies/npm)
|
|
||||||
[](https://www.bithound.io/github/pushrocks/smartstring)
|
|
||||||
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
|
||||||
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
|
||||||
[](http://standardjs.com/)
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
Use TypeScript for intellisense.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
import * as smartstring from "smartstring";
|
|
||||||
|
|
||||||
// classes
|
|
||||||
|
|
||||||
// smartstring.Domain class
|
|
||||||
let myDomain = new smartstring.Domain("https://sub.main.tld");
|
|
||||||
myDomain.level1 // "tld"
|
|
||||||
myDomain.level2 // "main"
|
|
||||||
// level3 , level 4 and so on...
|
|
||||||
myDomain.zoneName // "main.tld"
|
|
||||||
myDOmain.protocol // "https"
|
|
||||||
|
|
||||||
// smartstring.GitRepo class
|
|
||||||
let myGitRepo = new smartstring.GitRepo("git@github.com:someorg/somerepo.git"); // takes https and git and npm repo URL versions
|
|
||||||
myGitRepo.host // "github.com"
|
|
||||||
myGitRepo.user // "someorg"
|
|
||||||
myGitRepo.repo // "somerepo"
|
|
||||||
myGitRepo.accessToken // accessToken if specified with https
|
|
||||||
myGitRepo.sshUrl // "git@github.com:someorg/somerepo.git" (computed also from https)
|
|
||||||
myGitRepo.httpsUrl // "https://github.com/someorg/somerepo.git" (computed also from ssh)
|
|
||||||
|
|
||||||
//smartstring.Base64
|
|
||||||
let myBase64 = new smartstring.Base64('somestring','string') // first arg is the string, second is string type (can be string, base64, base64uri)
|
|
||||||
myBase64.simpleString // 'somestring'
|
|
||||||
myBase64.base64String // base64 representation of 'somestring'
|
|
||||||
myBase64.base64UriString // base64uri representation of 'sometring'
|
|
||||||
|
|
||||||
// methods
|
|
||||||
smartstring.base64.encode('somestring') // encodes 'somestring' to base64
|
|
||||||
smartstring.base64.encodeUri('sometring') // encodes 'somestring' to base64uri
|
|
||||||
smartstring.base64.decode() // decodes base64 and base64uri to simple string respresentation
|
|
||||||
|
|
||||||
smartstring.indent.indent('somestring\anotherstring', 4) // indents a string by 4
|
|
||||||
smartstring.indent.indent('somestring\anotherstring', '>>>> ') // indents a string with a prefix
|
|
||||||
smartstring.indent.normalize(' somestring\ anotherstring', '>>>> ') // looks for the least amount of indention and removes superflouous space
|
|
||||||
```
|
|
||||||
|
|
||||||
[](https://push.rocks)
|
|
7
dist/index.d.ts
vendored
7
dist/index.d.ts
vendored
@ -1,7 +0,0 @@
|
|||||||
import * as docker from './smartstring.docker';
|
|
||||||
import * as indent from './smartstring.indent';
|
|
||||||
import * as typescript from './smartstring.typescript';
|
|
||||||
export { docker, typescript, indent };
|
|
||||||
export { Base64, base64 } from './smartstring.base64';
|
|
||||||
export { Domain } from './smartstring.domain';
|
|
||||||
export { GitRepo } from './smartstring.git';
|
|
15
dist/index.js
vendored
15
dist/index.js
vendored
@ -1,15 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
const docker = require("./smartstring.docker");
|
|
||||||
exports.docker = docker;
|
|
||||||
const indent = require("./smartstring.indent");
|
|
||||||
exports.indent = indent;
|
|
||||||
const typescript = require("./smartstring.typescript");
|
|
||||||
exports.typescript = typescript;
|
|
||||||
var smartstring_base64_1 = require("./smartstring.base64");
|
|
||||||
exports.Base64 = smartstring_base64_1.Base64;
|
|
||||||
exports.base64 = smartstring_base64_1.base64;
|
|
||||||
var smartstring_domain_1 = require("./smartstring.domain");
|
|
||||||
exports.Domain = smartstring_domain_1.Domain;
|
|
||||||
var smartstring_git_1 = require("./smartstring.git");
|
|
||||||
exports.GitRepo = smartstring_git_1.GitRepo;
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsK0NBQThDO0FBSzFDLHdCQUFNO0FBSlYsK0NBQThDO0FBTTFDLHdCQUFNO0FBTFYsdURBQXNEO0FBSWxELGdDQUFVO0FBSWQsMkRBQXFEO0FBQTVDLHNDQUFBLE1BQU0sQ0FBQTtBQUFFLHNDQUFBLE1BQU0sQ0FBQTtBQUN2QiwyREFBNkM7QUFBcEMsc0NBQUEsTUFBTSxDQUFBO0FBQ2YscURBQTJDO0FBQWxDLG9DQUFBLE9BQU8sQ0FBQSJ9
|
|
28
dist/smartstring.base64.d.ts
vendored
28
dist/smartstring.base64.d.ts
vendored
@ -1,28 +0,0 @@
|
|||||||
/**
|
|
||||||
* the type for base 64
|
|
||||||
*/
|
|
||||||
export declare type TBase64Input = 'string' | 'base64' | 'base64uri';
|
|
||||||
/**
|
|
||||||
* handle base64 strings
|
|
||||||
*/
|
|
||||||
export declare class Base64 {
|
|
||||||
private refString;
|
|
||||||
constructor(inputStringArg: any, typeArg: TBase64Input);
|
|
||||||
/**
|
|
||||||
* the simple string (unencoded)
|
|
||||||
*/
|
|
||||||
readonly simpleString: string;
|
|
||||||
/**
|
|
||||||
* the base64 encoded version of the original string
|
|
||||||
*/
|
|
||||||
readonly base64String: any;
|
|
||||||
/**
|
|
||||||
* the base64uri encoded version of the original string
|
|
||||||
*/
|
|
||||||
readonly base64UriString: any;
|
|
||||||
}
|
|
||||||
export declare let base64: {
|
|
||||||
encode: (stringArg: string) => any;
|
|
||||||
encodeUri: (stringArg: string) => any;
|
|
||||||
decode: (stringArg: string) => any;
|
|
||||||
};
|
|
59
dist/smartstring.base64.js
vendored
59
dist/smartstring.base64.js
vendored
@ -1,59 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
const plugins = require("./smartstring.plugins");
|
|
||||||
/**
|
|
||||||
* handle base64 strings
|
|
||||||
*/
|
|
||||||
class Base64 {
|
|
||||||
constructor(inputStringArg, typeArg) {
|
|
||||||
switch (typeArg) {
|
|
||||||
case 'string':
|
|
||||||
this.refString = inputStringArg;
|
|
||||||
break;
|
|
||||||
case 'base64':
|
|
||||||
this.refString = exports.base64.decode(inputStringArg);
|
|
||||||
break;
|
|
||||||
case 'base64uri':
|
|
||||||
this.refString = exports.base64.decode(inputStringArg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* the simple string (unencoded)
|
|
||||||
*/
|
|
||||||
get simpleString() {
|
|
||||||
return this.refString;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* the base64 encoded version of the original string
|
|
||||||
*/
|
|
||||||
get base64String() {
|
|
||||||
return exports.base64.encode(this.refString);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* the base64uri encoded version of the original string
|
|
||||||
*/
|
|
||||||
get base64UriString() {
|
|
||||||
return exports.base64.encodeUri(this.refString);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.Base64 = Base64;
|
|
||||||
exports.base64 = {
|
|
||||||
/**
|
|
||||||
* encodes the string
|
|
||||||
*/
|
|
||||||
encode: (stringArg) => {
|
|
||||||
return plugins.jsBase64.encode(stringArg);
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* encodes a stringArg to base64 uri style
|
|
||||||
*/
|
|
||||||
encodeUri: (stringArg) => {
|
|
||||||
return plugins.jsBase64.encodeURI(stringArg);
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* decodes a base64 encoded string
|
|
||||||
*/
|
|
||||||
decode: (stringArg) => {
|
|
||||||
return plugins.jsBase64.decode(stringArg);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzdHJpbmcuYmFzZTY0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRzdHJpbmcuYmFzZTY0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxpREFBZ0Q7QUFPaEQ7O0dBRUc7QUFDSDtJQUVJLFlBQVksY0FBYyxFQUFFLE9BQXFCO1FBQzdDLE1BQU0sQ0FBQyxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUM7WUFDZCxLQUFLLFFBQVE7Z0JBQ1QsSUFBSSxDQUFDLFNBQVMsR0FBRyxjQUFjLENBQUE7Z0JBQy9CLEtBQUssQ0FBQTtZQUNULEtBQUssUUFBUTtnQkFDVCxJQUFJLENBQUMsU0FBUyxHQUFHLGNBQU0sQ0FBQyxNQUFNLENBQUMsY0FBYyxDQUFDLENBQUE7Z0JBQzlDLEtBQUssQ0FBQTtZQUNULEtBQUssV0FBVztnQkFDWixJQUFJLENBQUMsU0FBUyxHQUFHLGNBQU0sQ0FBQyxNQUFNLENBQUMsY0FBYyxDQUFDLENBQUE7UUFDdEQsQ0FBQztJQUNMLENBQUM7SUFFRDs7T0FFRztJQUNILElBQUksWUFBWTtRQUNaLE1BQU0sQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFBO0lBQ3pCLENBQUM7SUFFRDs7T0FFRztJQUNILElBQUksWUFBWTtRQUNaLE1BQU0sQ0FBQyxjQUFNLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxTQUFTLENBQUMsQ0FBQTtJQUN4QyxDQUFDO0lBRUQ7O09BRUc7SUFDSCxJQUFJLGVBQWU7UUFDZixNQUFNLENBQUMsY0FBTSxDQUFDLFNBQVMsQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLENBQUE7SUFDM0MsQ0FBQztDQUNKO0FBbkNELHdCQW1DQztBQUVVLFFBQUEsTUFBTSxHQUFHO0lBQ2hCOztPQUVHO0lBQ0gsTUFBTSxFQUFFLENBQUMsU0FBaUI7UUFDdEIsTUFBTSxDQUFDLE9BQU8sQ0FBQyxRQUFRLENBQUMsTUFBTSxDQUFDLFNBQVMsQ0FBQyxDQUFBO0lBQzdDLENBQUM7SUFFRDs7T0FFRztJQUNILFNBQVMsRUFBRSxDQUFDLFNBQWlCO1FBQ3pCLE1BQU0sQ0FBQyxPQUFPLENBQUMsUUFBUSxDQUFDLFNBQVMsQ0FBQyxTQUFTLENBQUMsQ0FBQTtJQUNoRCxDQUFDO0lBRUQ7O09BRUc7SUFDSCxNQUFNLEVBQUUsQ0FBQyxTQUFpQjtRQUN0QixNQUFNLENBQUMsT0FBTyxDQUFDLFFBQVEsQ0FBQyxNQUFNLENBQUMsU0FBUyxDQUFDLENBQUE7SUFDN0MsQ0FBQztDQUNKLENBQUEifQ==
|
|
6
dist/smartstring.docker.d.ts
vendored
6
dist/smartstring.docker.d.ts
vendored
@ -1,6 +0,0 @@
|
|||||||
/**
|
|
||||||
* converts an erray of env strings from docker remote api to an usable object.
|
|
||||||
* @param envArrayArg
|
|
||||||
* @returns {}
|
|
||||||
*/
|
|
||||||
export declare let makeEnvObject: (envArrayArg: string[]) => {};
|
|
19
dist/smartstring.docker.js
vendored
19
dist/smartstring.docker.js
vendored
@ -1,19 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
/**
|
|
||||||
* converts an erray of env strings from docker remote api to an usable object.
|
|
||||||
* @param envArrayArg
|
|
||||||
* @returns {}
|
|
||||||
*/
|
|
||||||
exports.makeEnvObject = function (envArrayArg) {
|
|
||||||
let returnObject = {};
|
|
||||||
let regexString = /(.*)=(.*)/;
|
|
||||||
if (typeof envArrayArg !== 'undefined') {
|
|
||||||
for (let envKey in envArrayArg) {
|
|
||||||
let regexMatches = regexString.exec(envArrayArg[envKey]);
|
|
||||||
returnObject[regexMatches[1]] = regexMatches[2];
|
|
||||||
}
|
|
||||||
;
|
|
||||||
}
|
|
||||||
return returnObject;
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzdHJpbmcuZG9ja2VyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRzdHJpbmcuZG9ja2VyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFFQTs7OztHQUlHO0FBQ1EsUUFBQSxhQUFhLEdBQUcsVUFBVSxXQUFxQjtJQUN0RCxJQUFJLFlBQVksR0FBRyxFQUFFLENBQUE7SUFDckIsSUFBSSxXQUFXLEdBQUcsV0FBVyxDQUFBO0lBQzdCLEVBQUUsQ0FBQyxDQUFDLE9BQU8sV0FBVyxLQUFLLFdBQVcsQ0FBQyxDQUFDLENBQUM7UUFDckMsR0FBRyxDQUFDLENBQUMsSUFBSSxNQUFNLElBQUksV0FBVyxDQUFDLENBQUMsQ0FBQztZQUM3QixJQUFJLFlBQVksR0FBRyxXQUFXLENBQUMsSUFBSSxDQUFDLFdBQVcsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFBO1lBQ3hELFlBQVksQ0FBQyxZQUFZLENBQUMsQ0FBQyxDQUFDLENBQUMsR0FBRyxZQUFZLENBQUMsQ0FBQyxDQUFDLENBQUE7UUFDbkQsQ0FBQztRQUFBLENBQUM7SUFDTixDQUFDO0lBQ0QsTUFBTSxDQUFDLFlBQVksQ0FBQTtBQUN2QixDQUFDLENBQUEifQ==
|
|
14
dist/smartstring.domain.d.ts
vendored
14
dist/smartstring.domain.d.ts
vendored
@ -1,14 +0,0 @@
|
|||||||
export declare class Domain {
|
|
||||||
fullName: string;
|
|
||||||
level1: string;
|
|
||||||
level2: string;
|
|
||||||
level3: string;
|
|
||||||
level4: string;
|
|
||||||
level5: string;
|
|
||||||
protocol: string;
|
|
||||||
zoneName: string;
|
|
||||||
topLevel: string;
|
|
||||||
domainName: any;
|
|
||||||
subDomain: any;
|
|
||||||
constructor(domainStringArg: string);
|
|
||||||
}
|
|
52
dist/smartstring.domain.js
vendored
52
dist/smartstring.domain.js
vendored
@ -1,52 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
class Domain {
|
|
||||||
constructor(domainStringArg) {
|
|
||||||
let regexMatches = domainRegex(domainStringArg);
|
|
||||||
this.fullName = '';
|
|
||||||
for (let i = 1; i <= 5; i++) {
|
|
||||||
if (regexMatches[i - 1]) {
|
|
||||||
let localMatch = regexMatches[i - 1];
|
|
||||||
this['level' + i.toString()] = localMatch;
|
|
||||||
if (this.fullName === '') {
|
|
||||||
this.fullName = localMatch;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.fullName = localMatch + '.' + this.fullName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this['level' + i.toString()] = undefined;
|
|
||||||
}
|
|
||||||
;
|
|
||||||
}
|
|
||||||
;
|
|
||||||
this.protocol = protocolRegex(domainStringArg);
|
|
||||||
this.zoneName = this.level2 + '.' + this.level1;
|
|
||||||
// aliases
|
|
||||||
this.topLevel = this.level1;
|
|
||||||
this.domainName = this.level2;
|
|
||||||
this.subDomain = this.level3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.Domain = Domain;
|
|
||||||
let domainRegex = function (stringArg) {
|
|
||||||
let regexString = /([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}$/;
|
|
||||||
let regexMatches = regexString.exec(stringArg);
|
|
||||||
regexMatches.reverse(); //make sure we build the domain from toplevel to subdomain (reversed order)
|
|
||||||
regexMatches.pop(); // pop the last element, which is, since we reversed the Array, the full String of matched elements
|
|
||||||
let regexMatchesFiltered = regexMatches.filter(function (stringArg) {
|
|
||||||
return (stringArg !== '');
|
|
||||||
});
|
|
||||||
return regexMatchesFiltered;
|
|
||||||
};
|
|
||||||
let protocolRegex = function (stringArg) {
|
|
||||||
let regexString = /^([a-zA-Z0-9]*):\/\//;
|
|
||||||
let regexMatches = regexString.exec(stringArg);
|
|
||||||
if (regexMatches) {
|
|
||||||
return regexMatches[1];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzdHJpbmcuZG9tYWluLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRzdHJpbmcuZG9tYWluLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFFQTtJQWFJLFlBQVksZUFBc0I7UUFDOUIsSUFBSSxZQUFZLEdBQUcsV0FBVyxDQUFDLGVBQWUsQ0FBQyxDQUFDO1FBQ2hELElBQUksQ0FBQyxRQUFRLEdBQUcsRUFBRSxDQUFBO1FBQ2xCLEdBQUcsQ0FBQyxDQUFDLElBQUksQ0FBQyxHQUFHLENBQUMsRUFBRSxDQUFDLElBQUksQ0FBQyxFQUFFLENBQUMsRUFBRSxFQUFFLENBQUM7WUFDMUIsRUFBRSxDQUFDLENBQUMsWUFBWSxDQUFDLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7Z0JBQ3RCLElBQUksVUFBVSxHQUFHLFlBQVksQ0FBQyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUE7Z0JBQ3BDLElBQUksQ0FBQyxPQUFPLEdBQUcsQ0FBQyxDQUFDLFFBQVEsRUFBRSxDQUFDLEdBQUcsVUFBVSxDQUFBO2dCQUN6QyxFQUFFLENBQUMsQ0FBQyxJQUFJLENBQUMsUUFBUSxLQUFLLEVBQUUsQ0FBQyxDQUFBLENBQUM7b0JBQ3RCLElBQUksQ0FBQyxRQUFRLEdBQUcsVUFBVSxDQUFBO2dCQUM5QixDQUFDO2dCQUFDLElBQUksQ0FBQyxDQUFDO29CQUNKLElBQUksQ0FBQyxRQUFRLEdBQUcsVUFBVSxHQUFHLEdBQUcsR0FBRyxJQUFJLENBQUMsUUFBUSxDQUFBO2dCQUNwRCxDQUFDO1lBQ0wsQ0FBQztZQUFDLElBQUksQ0FBQyxDQUFDO2dCQUNKLElBQUksQ0FBQyxPQUFPLEdBQUcsQ0FBQyxDQUFDLFFBQVEsRUFBRSxDQUFDLEdBQUcsU0FBUyxDQUFBO1lBQzVDLENBQUM7WUFBQSxDQUFDO1FBQ04sQ0FBQztRQUFBLENBQUM7UUFDRixJQUFJLENBQUMsUUFBUSxHQUFHLGFBQWEsQ0FBQyxlQUFlLENBQUMsQ0FBQTtRQUM5QyxJQUFJLENBQUMsUUFBUSxHQUFHLElBQUksQ0FBQyxNQUFNLEdBQUcsR0FBRyxHQUFHLElBQUksQ0FBQyxNQUFNLENBQUE7UUFFL0MsVUFBVTtRQUNWLElBQUksQ0FBQyxRQUFRLEdBQUcsSUFBSSxDQUFDLE1BQU0sQ0FBQTtRQUMzQixJQUFJLENBQUMsVUFBVSxHQUFHLElBQUksQ0FBQyxNQUFNLENBQUE7UUFDN0IsSUFBSSxDQUFDLFNBQVMsR0FBRyxJQUFJLENBQUMsTUFBTSxDQUFBO0lBQ2hDLENBQUM7Q0FDSjtBQXJDRCx3QkFxQ0M7QUFHRCxJQUFJLFdBQVcsR0FBRyxVQUFTLFNBQWdCO0lBQ3ZDLElBQUksV0FBVyxHQUFHLGdJQUFnSSxDQUFBO0lBQ2xKLElBQUksWUFBWSxHQUFHLFdBQVcsQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLENBQUE7SUFDOUMsWUFBWSxDQUFDLE9BQU8sRUFBRSxDQUFBLENBQUMsMkVBQTJFO0lBQ2xHLFlBQVksQ0FBQyxHQUFHLEVBQUUsQ0FBQSxDQUFDLG1HQUFtRztJQUN0SCxJQUFJLG9CQUFvQixHQUFHLFlBQVksQ0FBQyxNQUFNLENBQUMsVUFBUyxTQUFnQjtRQUNwRSxNQUFNLENBQUEsQ0FBQyxTQUFTLEtBQUssRUFBRSxDQUFDLENBQUE7SUFDNUIsQ0FBQyxDQUFDLENBQUM7SUFDSCxNQUFNLENBQUMsb0JBQW9CLENBQUE7QUFDL0IsQ0FBQyxDQUFDO0FBRUYsSUFBSSxhQUFhLEdBQUcsVUFBUyxTQUFnQjtJQUN6QyxJQUFJLFdBQVcsR0FBRyxzQkFBc0IsQ0FBQTtJQUN4QyxJQUFJLFlBQVksR0FBRyxXQUFXLENBQUMsSUFBSSxDQUFDLFNBQVMsQ0FBQyxDQUFBO0lBQzlDLEVBQUUsQ0FBQSxDQUFDLFlBQVksQ0FBQyxDQUFDLENBQUM7UUFDZCxNQUFNLENBQUMsWUFBWSxDQUFDLENBQUMsQ0FBQyxDQUFBO0lBQzFCLENBQUM7SUFBQyxJQUFJLENBQUMsQ0FBQztRQUNKLE1BQU0sQ0FBQyxTQUFTLENBQUE7SUFDcEIsQ0FBQztBQUNMLENBQUMsQ0FBQSJ9
|
|
9
dist/smartstring.git.d.ts
vendored
9
dist/smartstring.git.d.ts
vendored
@ -1,9 +0,0 @@
|
|||||||
export declare class GitRepo {
|
|
||||||
host: string;
|
|
||||||
user: string;
|
|
||||||
repo: string;
|
|
||||||
accessToken: string;
|
|
||||||
sshUrl: string;
|
|
||||||
httpsUrl: string;
|
|
||||||
constructor(stringArg: string, tokenArg?: string);
|
|
||||||
}
|
|
45
dist/smartstring.git.js
vendored
45
dist/smartstring.git.js
vendored
@ -1,45 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
/* ---------------------------------------------- *
|
|
||||||
* ------------------ classes ------------------- *
|
|
||||||
* ---------------------------------------------- */
|
|
||||||
class GitRepo {
|
|
||||||
constructor(stringArg, tokenArg) {
|
|
||||||
let regexMatches = gitRegex(stringArg);
|
|
||||||
this.host = regexMatches[1];
|
|
||||||
this.user = regexMatches[2];
|
|
||||||
this.repo = regexMatches[3];
|
|
||||||
this.accessToken = tokenArg;
|
|
||||||
this.sshUrl = gitLink(this.host, this.user, this.repo, this.accessToken, 'ssh');
|
|
||||||
this.httpsUrl = gitLink(this.host, this.user, this.repo, this.accessToken, 'https');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.GitRepo = GitRepo;
|
|
||||||
/* ---------------------------------------------- *
|
|
||||||
* ------------------ helpers ------------------- *
|
|
||||||
* ---------------------------------------------- */
|
|
||||||
let gitRegex = function (stringArg) {
|
|
||||||
let regexString = /([a-zA-Z0-9\-\.]*)(?:\/|\:)([a-zA-Z0-9\-\.]*)(?:\/)([a-zA-Z0-9\-\.]*)(?:\.git)/;
|
|
||||||
let regexMatches = regexString.exec(stringArg);
|
|
||||||
return regexMatches;
|
|
||||||
};
|
|
||||||
let gitLink = function (hostArg, userArg, repoArg, tokenArg = '', linkTypeArg) {
|
|
||||||
let returnString;
|
|
||||||
if (tokenArg !== '') {
|
|
||||||
tokenArg = tokenArg + '@';
|
|
||||||
}
|
|
||||||
switch (linkTypeArg) {
|
|
||||||
case 'https':
|
|
||||||
returnString = 'https://' +
|
|
||||||
tokenArg + hostArg + '/' + userArg + '/' + repoArg + '.git';
|
|
||||||
break;
|
|
||||||
case 'ssh':
|
|
||||||
returnString = 'git@' +
|
|
||||||
hostArg + ':' + userArg + '/' + repoArg + '.git';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
console.error('Link Type ' + linkTypeArg + ' not known');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return returnString;
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzdHJpbmcuZ2l0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRzdHJpbmcuZ2l0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFFQTs7b0RBRW9EO0FBQ3BEO0lBT0ksWUFBWSxTQUFpQixFQUFDLFFBQWlCO1FBQzNDLElBQUksWUFBWSxHQUFHLFFBQVEsQ0FBQyxTQUFTLENBQUMsQ0FBQTtRQUN0QyxJQUFJLENBQUMsSUFBSSxHQUFHLFlBQVksQ0FBQyxDQUFDLENBQUMsQ0FBQTtRQUMzQixJQUFJLENBQUMsSUFBSSxHQUFHLFlBQVksQ0FBQyxDQUFDLENBQUMsQ0FBQTtRQUMzQixJQUFJLENBQUMsSUFBSSxHQUFHLFlBQVksQ0FBQyxDQUFDLENBQUMsQ0FBQTtRQUMzQixJQUFJLENBQUMsV0FBVyxHQUFHLFFBQVEsQ0FBQTtRQUMzQixJQUFJLENBQUMsTUFBTSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsSUFBSSxFQUFDLElBQUksQ0FBQyxJQUFJLEVBQUMsSUFBSSxDQUFDLElBQUksRUFBQyxJQUFJLENBQUMsV0FBVyxFQUFFLEtBQUssQ0FBQyxDQUFBO1FBQzVFLElBQUksQ0FBQyxRQUFRLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLEVBQUMsSUFBSSxDQUFDLElBQUksRUFBQyxJQUFJLENBQUMsSUFBSSxFQUFDLElBQUksQ0FBQyxXQUFXLEVBQUUsT0FBTyxDQUFDLENBQUE7SUFDcEYsQ0FBQztDQUNKO0FBaEJELDBCQWdCQztBQUVEOztvREFFb0Q7QUFDcEQsSUFBSSxRQUFRLEdBQUcsVUFBUyxTQUFnQjtJQUNwQyxJQUFJLFdBQVcsR0FBRyxnRkFBZ0YsQ0FBQTtJQUNsRyxJQUFJLFlBQVksR0FBRyxXQUFXLENBQUMsSUFBSSxDQUFDLFNBQVMsQ0FBQyxDQUFBO0lBQzlDLE1BQU0sQ0FBQyxZQUFZLENBQUE7QUFDdkIsQ0FBQyxDQUFBO0FBRUQsSUFBSSxPQUFPLEdBQUcsVUFBUyxPQUFlLEVBQUUsT0FBZSxFQUFFLE9BQWUsRUFBRSxXQUFtQixFQUFFLEVBQUUsV0FBVztJQUN4RyxJQUFJLFlBQVksQ0FBQTtJQUNoQixFQUFFLENBQUMsQ0FBQyxRQUFRLEtBQUssRUFBRSxDQUFDLENBQUMsQ0FBQztRQUNsQixRQUFRLEdBQUcsUUFBUSxHQUFHLEdBQUcsQ0FBQTtJQUM3QixDQUFDO0lBQ0QsTUFBTSxDQUFDLENBQUMsV0FBVyxDQUFDLENBQUMsQ0FBQztRQUNsQixLQUFLLE9BQU87WUFDUixZQUFZLEdBQUcsVUFBVTtnQkFDckIsUUFBUSxHQUFHLE9BQU8sR0FBRyxHQUFHLEdBQUcsT0FBTyxHQUFHLEdBQUcsR0FBRyxPQUFPLEdBQUcsTUFBTSxDQUFBO1lBQy9ELEtBQUssQ0FBQTtRQUNULEtBQUssS0FBSztZQUNOLFlBQVksR0FBRyxNQUFNO2dCQUNqQixPQUFPLEdBQUcsR0FBRyxHQUFHLE9BQU8sR0FBRyxHQUFHLEdBQUcsT0FBTyxHQUFHLE1BQU0sQ0FBQztZQUNyRCxLQUFLLENBQUE7UUFDVDtZQUNJLE9BQU8sQ0FBQyxLQUFLLENBQUMsWUFBWSxHQUFHLFdBQVcsR0FBRyxZQUFZLENBQUMsQ0FBQTtZQUN4RCxLQUFLLENBQUE7SUFDYixDQUFDO0lBQ0QsTUFBTSxDQUFDLFlBQVksQ0FBQTtBQUN2QixDQUFDLENBQUEifQ==
|
|
3
dist/smartstring.indent.d.ts
vendored
3
dist/smartstring.indent.d.ts
vendored
@ -1,3 +0,0 @@
|
|||||||
export declare let indent: (stringArg: string, spaceAmount: number) => string;
|
|
||||||
export declare let indentWithPrefix: (stringArg: string, prefixArg: string) => string;
|
|
||||||
export declare let normalize: (stringArg: string) => string;
|
|
61
dist/smartstring.indent.js
vendored
61
dist/smartstring.indent.js
vendored
@ -1,61 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
let splitString = (stringArg) => {
|
|
||||||
let resultArray = stringArg.split('\n');
|
|
||||||
return cleanStringArray(resultArray);
|
|
||||||
};
|
|
||||||
let joinString = (stringArrayArg) => {
|
|
||||||
let resultString = '';
|
|
||||||
for (let line of stringArrayArg) {
|
|
||||||
resultString = resultString + line + '\n';
|
|
||||||
}
|
|
||||||
return resultString;
|
|
||||||
};
|
|
||||||
let cleanStringArray = (stringArrayArg) => {
|
|
||||||
let testRegex = /^[\s]*$/;
|
|
||||||
if (testRegex.test(stringArrayArg[0])) {
|
|
||||||
stringArrayArg.shift();
|
|
||||||
}
|
|
||||||
if (testRegex.test(stringArrayArg[stringArrayArg.length - 1])) {
|
|
||||||
stringArrayArg.pop();
|
|
||||||
}
|
|
||||||
;
|
|
||||||
return stringArrayArg;
|
|
||||||
};
|
|
||||||
exports.indent = (stringArg, spaceAmount) => {
|
|
||||||
let resultString;
|
|
||||||
return resultString;
|
|
||||||
};
|
|
||||||
exports.indentWithPrefix = (stringArg, prefixArg) => {
|
|
||||||
let resultString;
|
|
||||||
let stringArray = splitString(stringArg);
|
|
||||||
let resultArray = [];
|
|
||||||
for (let stringItem of stringArray) {
|
|
||||||
resultArray.push(prefixArg + stringItem);
|
|
||||||
}
|
|
||||||
;
|
|
||||||
resultString = joinString(resultArray);
|
|
||||||
return resultString;
|
|
||||||
};
|
|
||||||
exports.normalize = (stringArg) => {
|
|
||||||
let resultString;
|
|
||||||
let splitStringArray = splitString(stringArg);
|
|
||||||
let minCommonLeftOffset;
|
|
||||||
let deIndentRegex = /^(\s*)/;
|
|
||||||
let emptyLineRegex = /^(\s*)$/;
|
|
||||||
for (let stringItem of splitStringArray) {
|
|
||||||
let offsetString = deIndentRegex.exec(stringItem)[1];
|
|
||||||
if ((typeof minCommonLeftOffset === 'undefined' || offsetString.length < minCommonLeftOffset)
|
|
||||||
&& !emptyLineRegex.test(stringItem)) {
|
|
||||||
minCommonLeftOffset = offsetString.length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
;
|
|
||||||
let resultSplitStringArray = [];
|
|
||||||
for (let stringItem of splitStringArray) {
|
|
||||||
resultSplitStringArray.push(stringItem.substr(minCommonLeftOffset));
|
|
||||||
}
|
|
||||||
;
|
|
||||||
resultString = joinString(resultSplitStringArray);
|
|
||||||
return resultString;
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzdHJpbmcuaW5kZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRzdHJpbmcuaW5kZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFFQSxJQUFJLFdBQVcsR0FBRyxDQUFDLFNBQWlCO0lBQ2hDLElBQUksV0FBVyxHQUFHLFNBQVMsQ0FBQyxLQUFLLENBQUMsSUFBSSxDQUFDLENBQUE7SUFDdkMsTUFBTSxDQUFDLGdCQUFnQixDQUFDLFdBQVcsQ0FBQyxDQUFBO0FBQ3hDLENBQUMsQ0FBQztBQUVGLElBQUksVUFBVSxHQUFHLENBQUMsY0FBd0I7SUFDdEMsSUFBSSxZQUFZLEdBQVcsRUFBRSxDQUFBO0lBQzdCLEdBQUcsQ0FBQyxDQUFDLElBQUksSUFBSSxJQUFJLGNBQWMsQ0FBQyxDQUFBLENBQUM7UUFDN0IsWUFBWSxHQUFHLFlBQVksR0FBRyxJQUFJLEdBQUcsSUFBSSxDQUFBO0lBQzdDLENBQUM7SUFDRCxNQUFNLENBQUMsWUFBWSxDQUFBO0FBQ3ZCLENBQUMsQ0FBQTtBQUVELElBQUksZ0JBQWdCLEdBQUcsQ0FBQyxjQUF3QjtJQUM1QyxJQUFJLFNBQVMsR0FBRyxTQUFTLENBQUE7SUFDekIsRUFBRSxDQUFDLENBQUMsU0FBUyxDQUFDLElBQUksQ0FBQyxjQUFjLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7UUFDcEMsY0FBYyxDQUFDLEtBQUssRUFBRSxDQUFBO0lBQzFCLENBQUM7SUFDRCxFQUFFLENBQUMsQ0FBQyxTQUFTLENBQUMsSUFBSSxDQUFDLGNBQWMsQ0FBQyxjQUFjLENBQUMsTUFBTSxHQUFHLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDO1FBQzVELGNBQWMsQ0FBQyxHQUFHLEVBQUUsQ0FBQTtJQUN4QixDQUFDO0lBQUEsQ0FBQztJQUNGLE1BQU0sQ0FBQyxjQUFjLENBQUE7QUFDekIsQ0FBQyxDQUFBO0FBRVUsUUFBQSxNQUFNLEdBQUcsQ0FBQyxTQUFpQixFQUFFLFdBQW1CO0lBQ3ZELElBQUksWUFBb0IsQ0FBQTtJQUN4QixNQUFNLENBQUMsWUFBWSxDQUFBO0FBQ3ZCLENBQUMsQ0FBQTtBQUVVLFFBQUEsZ0JBQWdCLEdBQUcsQ0FBQyxTQUFpQixFQUFDLFNBQWlCO0lBQzlELElBQUksWUFBb0IsQ0FBQTtJQUN4QixJQUFJLFdBQVcsR0FBRyxXQUFXLENBQUMsU0FBUyxDQUFDLENBQUE7SUFDeEMsSUFBSSxXQUFXLEdBQWEsRUFBRSxDQUFBO0lBQzlCLEdBQUcsQ0FBQyxDQUFDLElBQUksVUFBVSxJQUFJLFdBQVcsQ0FBQyxDQUFBLENBQUM7UUFDaEMsV0FBVyxDQUFDLElBQUksQ0FBQyxTQUFTLEdBQUcsVUFBVSxDQUFDLENBQUE7SUFDNUMsQ0FBQztJQUFBLENBQUM7SUFDRixZQUFZLEdBQUcsVUFBVSxDQUFDLFdBQVcsQ0FBQyxDQUFBO0lBQ3RDLE1BQU0sQ0FBQyxZQUFZLENBQUE7QUFDdkIsQ0FBQyxDQUFBO0FBRVUsUUFBQSxTQUFTLEdBQUcsQ0FBQyxTQUFpQjtJQUNyQyxJQUFJLFlBQW9CLENBQUE7SUFDeEIsSUFBSSxnQkFBZ0IsR0FBYSxXQUFXLENBQUMsU0FBUyxDQUFDLENBQUE7SUFDdkQsSUFBSSxtQkFBMkIsQ0FBQTtJQUMvQixJQUFJLGFBQWEsR0FBRyxRQUFRLENBQUE7SUFDNUIsSUFBSSxjQUFjLEdBQUcsU0FBUyxDQUFBO0lBQzlCLEdBQUcsQ0FBQyxDQUFDLElBQUksVUFBVSxJQUFJLGdCQUFnQixDQUFDLENBQUEsQ0FBQztRQUNyQyxJQUFJLFlBQVksR0FBRyxhQUFhLENBQUMsSUFBSSxDQUFDLFVBQVUsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFBO1FBQ3BELEVBQUUsQ0FBQyxDQUNDLENBQUMsT0FBTyxtQkFBbUIsS0FBSyxXQUFXLElBQUksWUFBWSxDQUFDLE1BQU0sR0FBRyxtQkFBbUIsQ0FBQztlQUN0RixDQUFDLGNBQWMsQ0FBQyxJQUFJLENBQUMsVUFBVSxDQUN0QyxDQUFDLENBQUMsQ0FBQztZQUNDLG1CQUFtQixHQUFHLFlBQVksQ0FBQyxNQUFNLENBQUE7UUFDN0MsQ0FBQztJQUNMLENBQUM7SUFBQSxDQUFDO0lBQ0YsSUFBSSxzQkFBc0IsR0FBRyxFQUFFLENBQUE7SUFDL0IsR0FBRyxDQUFDLENBQUMsSUFBSSxVQUFVLElBQUksZ0JBQWdCLENBQUMsQ0FBQyxDQUFDO1FBQ3RDLHNCQUFzQixDQUFDLElBQUksQ0FBQyxVQUFVLENBQUMsTUFBTSxDQUFDLG1CQUFtQixDQUFDLENBQUMsQ0FBQTtJQUN2RSxDQUFDO0lBQUEsQ0FBQztJQUNGLFlBQVksR0FBRyxVQUFVLENBQUMsc0JBQXNCLENBQUMsQ0FBQTtJQUNqRCxNQUFNLENBQUMsWUFBWSxDQUFBO0FBQ3ZCLENBQUMsQ0FBQSJ9
|
|
2
dist/smartstring.plugins.d.ts
vendored
2
dist/smartstring.plugins.d.ts
vendored
@ -1,2 +0,0 @@
|
|||||||
import 'typings-global';
|
|
||||||
export declare let jsBase64: any;
|
|
4
dist/smartstring.plugins.js
vendored
4
dist/smartstring.plugins.js
vendored
@ -1,4 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
require("typings-global");
|
|
||||||
exports.jsBase64 = require('js-base64').Base64;
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzdHJpbmcucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0c3RyaW5nLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDBCQUF1QjtBQUNaLFFBQUEsUUFBUSxHQUFHLE9BQU8sQ0FBQyxXQUFXLENBQUMsQ0FBQyxNQUFNLENBQUEifQ==
|
|
1
dist/smartstring.typescript.d.ts
vendored
1
dist/smartstring.typescript.d.ts
vendored
@ -1 +0,0 @@
|
|||||||
export declare let regexReferencePath: RegExp;
|
|
3
dist/smartstring.typescript.js
vendored
3
dist/smartstring.typescript.js
vendored
@ -1,3 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
exports.regexReferencePath = /\/\/\/\s*<reference\s+path\s*=\s*["|'].*["|']\s*\/>\s*[\\n]?/;
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzdHJpbmcudHlwZXNjcmlwdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0c3RyaW5nLnR5cGVzY3JpcHQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUVXLFFBQUEsa0JBQWtCLEdBQUcsOERBQThELENBQUEifQ==
|
|
@ -1,6 +1,7 @@
|
|||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2016 Push.Rocks
|
Copyright (c) 2014 Maurice Butler
|
||||||
|
Copyright (c) 2016 Lossless GmbH
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
39
npmextra.json
Normal file
39
npmextra.json
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"npmci": {
|
||||||
|
"npmGlobalTools": [],
|
||||||
|
"npmAccessLevel": "public"
|
||||||
|
},
|
||||||
|
"npmdocker": {
|
||||||
|
"baseImage": "hosttoday/ht-docker-node:npmci",
|
||||||
|
"command": "npmci node install stable && npmci npm install && npmci npm test",
|
||||||
|
"dockerSock": false
|
||||||
|
},
|
||||||
|
"gitzone": {
|
||||||
|
"projectType": "npm",
|
||||||
|
"module": {
|
||||||
|
"githost": "code.foss.global",
|
||||||
|
"gitscope": "push.rocks",
|
||||||
|
"gitrepo": "smartstring",
|
||||||
|
"description": "A library for handling strings in smart ways, including manipulation and encoding, with TypeScript support.",
|
||||||
|
"npmPackagename": "@push.rocks/smartstring",
|
||||||
|
"license": "MIT",
|
||||||
|
"keywords": [
|
||||||
|
"string manipulation",
|
||||||
|
"encode",
|
||||||
|
"decode",
|
||||||
|
"base64",
|
||||||
|
"indentation",
|
||||||
|
"normalization",
|
||||||
|
"regex",
|
||||||
|
"random string",
|
||||||
|
"cryptographic string",
|
||||||
|
"domain parsing",
|
||||||
|
"git repository parsing",
|
||||||
|
"docker environment parsing"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tsdoc": {
|
||||||
|
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
||||||
|
}
|
||||||
|
}
|
72
package.json
72
package.json
@ -1,34 +1,70 @@
|
|||||||
{
|
{
|
||||||
"name": "smartstring",
|
"name": "@push.rocks/smartstring",
|
||||||
"version": "2.0.23",
|
"version": "4.0.15",
|
||||||
"description": "handle strings in smart ways. TypeScript ready.",
|
"private": false,
|
||||||
"main": "dist/index.js",
|
"description": "A library for handling strings in smart ways, including manipulation and encoding, with TypeScript support.",
|
||||||
"typings": "dist/index.d.ts",
|
"main": "dist_ts/index.js",
|
||||||
|
"typings": "dist_ts/index.d.ts",
|
||||||
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(npmts)"
|
"test": "(tstest test/)",
|
||||||
|
"build": "(tsbuild --web --allowimplicitany)",
|
||||||
|
"buildDocs": "tsdoc"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://gitlab.com/pushrocks/smartstring.git"
|
"url": "https://code.foss.global/push.rocks/smartstring.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
"string manipulation",
|
||||||
|
"encode",
|
||||||
|
"decode",
|
||||||
|
"base64",
|
||||||
|
"indentation",
|
||||||
|
"normalization",
|
||||||
"regex",
|
"regex",
|
||||||
"string"
|
"random string",
|
||||||
|
"cryptographic string",
|
||||||
|
"domain parsing",
|
||||||
|
"git repository parsing",
|
||||||
|
"docker environment parsing"
|
||||||
],
|
],
|
||||||
"author": "Lossless GmbH",
|
"author": "Lossless GmbH",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://gitlab.com/pushrocks/smartstring/issues"
|
"url": "https://gitlab.com/push.rocks/smartstring/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pushrocks/smartstring#readme",
|
"homepage": "https://code.foss.global/push.rocks/smartstring",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"beautylog": "^6.1.1",
|
"@git.zone/tsbuild": "^2.1.72",
|
||||||
"npmts-g": "^6.0.0",
|
"@git.zone/tsrun": "^1.2.42",
|
||||||
"smartchai": "^1.0.3",
|
"@git.zone/tstest": "^1.0.86",
|
||||||
"typings-test": "^1.0.3"
|
"@push.rocks/tapbundle": "^5.0.15",
|
||||||
|
"@types/node": "^20.11.24"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"js-base64": "^2.1.9",
|
"@push.rocks/isounique": "^1.0.5",
|
||||||
"typings-global": "^1.0.14"
|
"@push.rocks/smartenv": "^5.0.12",
|
||||||
}
|
"@types/randomatic": "^3.1.5",
|
||||||
}
|
"crypto-random-string": "^5.0.0",
|
||||||
|
"js-base64": "^3.7.7",
|
||||||
|
"randomatic": "^3.1.1",
|
||||||
|
"strip-indent": "^4.0.0",
|
||||||
|
"url": "^0.11.3"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"ts/**/*",
|
||||||
|
"ts_web/**/*",
|
||||||
|
"dist/**/*",
|
||||||
|
"dist_*/**/*",
|
||||||
|
"dist_ts/**/*",
|
||||||
|
"dist_ts_web/**/*",
|
||||||
|
"assets/**/*",
|
||||||
|
"cli.js",
|
||||||
|
"npmextra.json",
|
||||||
|
"readme.md"
|
||||||
|
],
|
||||||
|
"browserslist": [
|
||||||
|
"last 1 chrome versions"
|
||||||
|
]
|
||||||
|
}
|
5953
pnpm-lock.yaml
generated
Normal file
5953
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
1
readme.hints.md
Normal file
1
readme.hints.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
151
readme.md
Normal file
151
readme.md
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
# @push.rocks/smartstring
|
||||||
|
handle strings in smart ways. TypeScript ready.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
To install `@push.rocks/smartstring`, use the following npm command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install @push.rocks/smartstring --save
|
||||||
|
```
|
||||||
|
|
||||||
|
This will add it to your project's dependencies.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
The `@push.rocks/smartstring` package provides a powerful set of utilities to handle and manipulate strings in various ways, ready for TypeScript usage. Here's an exhaustive guide to using this package.
|
||||||
|
|
||||||
|
### Working with Domain Strings
|
||||||
|
|
||||||
|
The `Domain` class helps in parsing and extracting information from domain URLs.
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { Domain } from '@push.rocks/smartstring';
|
||||||
|
|
||||||
|
// Parse a domain URL
|
||||||
|
const myDomain = new Domain('https://sub.example.com');
|
||||||
|
console.log(myDomain.level1); // Output: "com"
|
||||||
|
console.log(myDomain.level2); // Output: "example"
|
||||||
|
console.log(myDomain.zoneName); // Output: "example.com"
|
||||||
|
console.log(myDomain.protocol); // Output: "https"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Handling Git Repositories
|
||||||
|
|
||||||
|
The `GitRepo` class is designed for extracting information from Git repository URLs.
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { GitRepo } from '@push.rocks/smartstring';
|
||||||
|
|
||||||
|
// Parse a Git repository URL
|
||||||
|
const myGitRepo = new GitRepo('git@github.com:user/repo.git');
|
||||||
|
console.log(myGitRepo.host); // Output: "github.com"
|
||||||
|
console.log(myGitRepo.user); // Output: "user"
|
||||||
|
console.log(myGitRepo.repo); // Output: "repo"
|
||||||
|
console.log(myGitRepo.sshUrl); // Output: "git@github.com:user/repo.git"
|
||||||
|
console.log(myGitRepo.httpsUrl); // Output: "https://github.com/user/repo.git"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Encoding and Decoding Base64 Strings
|
||||||
|
|
||||||
|
`@push.rocks/smartstring` offers base64 encoding and decoding through the `Base64` class and utility functions.
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { Base64, base64 } from '@push.rocks/smartstring';
|
||||||
|
|
||||||
|
// Using the Base64 class
|
||||||
|
const myBase64 = new Base64('hello world', 'string');
|
||||||
|
console.log(myBase64.base64String); // Encoded string
|
||||||
|
console.log(myBase64.base64UriString); // Encoded URI compatible string
|
||||||
|
|
||||||
|
// Using utility functions
|
||||||
|
const encoded = base64.encode('hello world');
|
||||||
|
const decoded = base64.decode(encoded);
|
||||||
|
console.log(encoded); // Encoded string
|
||||||
|
console.log(decoded); // "hello world"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Applying Indentation
|
||||||
|
|
||||||
|
SmartString allows you to easily indent strings or normalize indentation across a multi-line string.
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { indent } from '@push.rocks/smartstring';
|
||||||
|
|
||||||
|
// Indent a string by 4 spaces
|
||||||
|
const indentedString = indent.indent('Some text\nAnother line', 4);
|
||||||
|
console.log(indentedString);
|
||||||
|
|
||||||
|
// Indent using a prefix
|
||||||
|
const prefixedString = indent.indentWithPrefix('Line 1\nLine 2', '> ');
|
||||||
|
console.log(prefixedString);
|
||||||
|
|
||||||
|
// Normalize indentation
|
||||||
|
const normalizedString = indent.normalize(' Some indented text\n Another line');
|
||||||
|
console.log(normalizedString);
|
||||||
|
```
|
||||||
|
|
||||||
|
### Creating Random or Encrypted Strings
|
||||||
|
|
||||||
|
Create random strings based on patterns or generate cryptographically strong random strings.
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { create } from '@push.rocks/smartstring';
|
||||||
|
|
||||||
|
// Create a random string
|
||||||
|
const randomString = create.createRandomString('aA0', 10);
|
||||||
|
console.log(randomString); // Example output: "a9mB8v2Dq1"
|
||||||
|
|
||||||
|
// Create a crypto-random string
|
||||||
|
const cryptoString = create.createCryptoRandomString(10);
|
||||||
|
console.log(cryptoString); // Example output: "f28Bb90aCc"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Normalizing Strings
|
||||||
|
|
||||||
|
Normalize strings by removing leading/trailing whitespace, fixing indentation, and more.
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { normalize } from '@push.rocks/smartstring';
|
||||||
|
|
||||||
|
// Normalize a multi-line string
|
||||||
|
const exampleString = `
|
||||||
|
This is an example.
|
||||||
|
The indentation will be fixed.
|
||||||
|
`;
|
||||||
|
const normalized = normalize.standard(exampleString);
|
||||||
|
console.log(normalized);
|
||||||
|
```
|
||||||
|
|
||||||
|
### Working with Docker Environment Variables
|
||||||
|
|
||||||
|
Transform an array of Docker environment variables into an object for easy access.
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { docker } from '@push.rocks/smartstring';
|
||||||
|
|
||||||
|
const envVars = ['NODE_ENV=production', 'PORT=3000'];
|
||||||
|
const envObject = docker.makeEnvObject(envVars);
|
||||||
|
console.log(envObject.NODE_ENV); // Output: "production"
|
||||||
|
console.log(envObject.PORT); // Output: "3000"
|
||||||
|
```
|
||||||
|
|
||||||
|
This guide covers the primary features of `@push.rocks/smartstring`, making string manipulation and information extraction simple and efficient in your TypeScript projects.
|
||||||
|
|
||||||
|
## License and Legal Information
|
||||||
|
|
||||||
|
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
|
||||||
|
|
||||||
|
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
### Trademarks
|
||||||
|
|
||||||
|
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
|
||||||
|
|
||||||
|
### Company Information
|
||||||
|
|
||||||
|
Task Venture Capital GmbH
|
||||||
|
Registered at District court Bremen HRB 35230 HB, Germany
|
||||||
|
|
||||||
|
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
|
||||||
|
|
||||||
|
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
23
test/test.base64.both.ts
Normal file
23
test/test.base64.both.ts
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import * as smartstring from '../ts/index.js';
|
||||||
|
import { tap, expect } from '@push.rocks/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();
|
1
test/test.d.ts
vendored
1
test/test.d.ts
vendored
@ -1 +0,0 @@
|
|||||||
import 'typings-test';
|
|
12
test/test.docker.both.ts
Normal file
12
test/test.docker.both.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import * as smartstring from '../ts/index.js';
|
||||||
|
import { tap, expect } from '@push.rocks/tapbundle';
|
||||||
|
|
||||||
|
// Docker
|
||||||
|
tap.test('expect create a Env Object', async () => {
|
||||||
|
let envStringArray = ['VIRTUAL_HOST=sub.domain.tld', 'DEFAULT_HOST=some.domain.com'];
|
||||||
|
let envObject: any = smartstring.docker.makeEnvObject(envStringArray);
|
||||||
|
expect(envObject.VIRTUAL_HOST).toEqual('sub.domain.tld');
|
||||||
|
expect(envObject.DEFAULT_HOST).toEqual('some.domain.com');
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.start();
|
37
test/test.domain.both.ts
Normal file
37
test/test.domain.both.ts
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
import * as smartstring from '../ts/index.js';
|
||||||
|
import { tap, expect } from '@push.rocks/tapbundle';
|
||||||
|
|
||||||
|
// Domain
|
||||||
|
let testDomain: smartstring.Domain;
|
||||||
|
let testDomain2: smartstring.Domain;
|
||||||
|
tap.test('expect create a new Domain object', async () => {
|
||||||
|
testDomain = new smartstring.Domain('https://level3D.level2D.level1D');
|
||||||
|
expect(testDomain).toBeInstanceOf(smartstring.Domain);
|
||||||
|
console.log(testDomain);
|
||||||
|
});
|
||||||
|
tap.test('expect have a .topLevel', async () => {
|
||||||
|
expect(testDomain.topLevel).toEqual('level1D');
|
||||||
|
});
|
||||||
|
tap.test('expect have a .level2', async () => {
|
||||||
|
expect(testDomain.level2).toEqual('level2D');
|
||||||
|
});
|
||||||
|
tap.test('expect have a .level3', async () => {
|
||||||
|
expect(testDomain.level3).toEqual('level3D');
|
||||||
|
});
|
||||||
|
tap.test('expect have the correct dns zone name', async () => {
|
||||||
|
expect(testDomain.zoneName).toEqual('level2D.level1D');
|
||||||
|
});
|
||||||
|
tap.test('expect have the correct protocol', async () => {
|
||||||
|
expect(testDomain.protocol).toEqual('https');
|
||||||
|
});
|
||||||
|
tap.test('testDomain2 expect be a basic domain', async () => {
|
||||||
|
testDomain2 = new smartstring.Domain('testing.bleu.de');
|
||||||
|
console.log(testDomain2);
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('should parse complex domains', async () => {
|
||||||
|
testDomain2 = new smartstring.Domain('https://sub1.sub2.lossless.com/some/path:5431');
|
||||||
|
console.log(testDomain2);
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.start();
|
26
test/test.git.both.ts
Normal file
26
test/test.git.both.ts
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import * as smartstring from '../ts/index.js';
|
||||||
|
import { tap, expect } from '@push.rocks/tapbundle';
|
||||||
|
|
||||||
|
// git
|
||||||
|
let testGit: smartstring.GitRepo;
|
||||||
|
tap.test('expect create a new Git class GitRepo', async () => {
|
||||||
|
testGit = new smartstring.GitRepo('git+https://github.com/pushrocks/smartstring.git');
|
||||||
|
expect(testGit).toBeInstanceOf(smartstring.GitRepo);
|
||||||
|
});
|
||||||
|
tap.test('expect return a .host', async () => {
|
||||||
|
expect(testGit.host).toEqual('github.com');
|
||||||
|
});
|
||||||
|
tap.test('expect return a .user', async () => {
|
||||||
|
expect(testGit.user).toEqual('pushrocks');
|
||||||
|
});
|
||||||
|
tap.test('expect return a .repo', async () => {
|
||||||
|
expect(testGit.repo).toEqual('smartstring');
|
||||||
|
});
|
||||||
|
tap.test('expect return a .httpsUrl', async () => {
|
||||||
|
expect(testGit.httpsUrl).toEqual('https://github.com/pushrocks/smartstring.git');
|
||||||
|
});
|
||||||
|
tap.test('expect return a .sshUrl', async () => {
|
||||||
|
expect(testGit.sshUrl).toEqual('git@github.com:pushrocks/smartstring.git');
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.start();
|
28
test/test.indent.both.ts
Normal file
28
test/test.indent.both.ts
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import * as smartstring from '../ts/index.js';
|
||||||
|
import { tap, expect } from '@push.rocks/tapbundle';
|
||||||
|
|
||||||
|
// indent
|
||||||
|
let testString = `
|
||||||
|
base
|
||||||
|
expect be indented
|
||||||
|
some more
|
||||||
|
|
||||||
|
base
|
||||||
|
indented
|
||||||
|
`;
|
||||||
|
|
||||||
|
// normalize
|
||||||
|
tap.test('expect normalize a string', async () => {
|
||||||
|
testString = smartstring.indent.normalize(testString);
|
||||||
|
console.log(testString);
|
||||||
|
let zoneNameArg = 'test1';
|
||||||
|
let destinationIpArg = '111';
|
||||||
|
});
|
||||||
|
|
||||||
|
// indent with prefix
|
||||||
|
tap.test('expect indent', async () => {
|
||||||
|
testString = smartstring.indent.indentWithPrefix(testString, '>> ');
|
||||||
|
console.log(testString);
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.start();
|
112
test/test.js
112
test/test.js
File diff suppressed because one or more lines are too long
20
test/test.normalize.both.ts
Normal file
20
test/test.normalize.both.ts
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import { tap, expect } from '@push.rocks/tapbundle';
|
||||||
|
|
||||||
|
import * as smartstring from '../ts/index.js';
|
||||||
|
|
||||||
|
tap.test('should normalize a string', async (toolsArg) => {
|
||||||
|
const testString = `
|
||||||
|
myawesome string;
|
||||||
|
is indented with two spaces
|
||||||
|
`;
|
||||||
|
const normalizedString = smartstring.normalize.standard(testString);
|
||||||
|
console.log(normalizedString);
|
||||||
|
|
||||||
|
expect(normalizedString).toEqual(
|
||||||
|
`myawesome string;
|
||||||
|
is indented with two spaces
|
||||||
|
`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.start();
|
118
test/test.ts
118
test/test.ts
@ -1,118 +0,0 @@
|
|||||||
import 'typings-test'
|
|
||||||
import * as smartstring from '../dist/index'
|
|
||||||
import { expect } from 'smartchai'
|
|
||||||
|
|
||||||
describe('smartstring', function () {
|
|
||||||
describe('.Base64 class', function () {
|
|
||||||
let testBase64: smartstring.Base64
|
|
||||||
it('expect create a valid instance of Base64', function () {
|
|
||||||
testBase64 = new smartstring.Base64('somestring', 'string')
|
|
||||||
expect(testBase64).be.instanceOf(smartstring.Base64)
|
|
||||||
})
|
|
||||||
it('expect read output a file as base64 and base64uri', function () {
|
|
||||||
expect(testBase64.base64String).not.equal(testBase64.base64UriString)
|
|
||||||
let testBase64_2 = new smartstring.Base64(testBase64.base64UriString, 'base64uri')
|
|
||||||
expect(testBase64_2.simpleString).equal(testBase64.simpleString)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
describe('.Domain class', function () {
|
|
||||||
let testDomain: smartstring.Domain
|
|
||||||
let testDomain2: smartstring.Domain
|
|
||||||
it('expect create a new Domain object', function () {
|
|
||||||
testDomain = new smartstring.Domain('https://level3D.level2D.level1D')
|
|
||||||
expect(testDomain).be.instanceof(smartstring.Domain)
|
|
||||||
console.log(testDomain)
|
|
||||||
})
|
|
||||||
it('expect have a .topLevel', function () {
|
|
||||||
expect(testDomain.topLevel).equal('level1D')
|
|
||||||
})
|
|
||||||
it('expect have a .level2', function () {
|
|
||||||
expect(testDomain.level2).equal('level2D')
|
|
||||||
})
|
|
||||||
it('expect have a .level3', function () {
|
|
||||||
expect(testDomain.level3).equal('level3D')
|
|
||||||
})
|
|
||||||
it('expect have the correct dns zone name', function () {
|
|
||||||
expect(testDomain.zoneName).equal('level2D.level1D')
|
|
||||||
})
|
|
||||||
it('expect have the correct protocol', function () {
|
|
||||||
expect(testDomain.protocol).equal('https')
|
|
||||||
})
|
|
||||||
it('testDomain2 expect be a basic domain', function () {
|
|
||||||
testDomain2 = new smartstring.Domain('bleu.de')
|
|
||||||
console.log(testDomain2)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
describe('.Git class', function () {
|
|
||||||
let testGit: smartstring.GitRepo
|
|
||||||
it('expect create a new Git class GitRepo', function () {
|
|
||||||
testGit = new smartstring.GitRepo('git+https://github.com/pushrocks/smartstring.git')
|
|
||||||
expect(testGit).be.instanceof(smartstring.GitRepo)
|
|
||||||
})
|
|
||||||
it('expect return a .host', function () {
|
|
||||||
expect(testGit.host).equal('github.com')
|
|
||||||
})
|
|
||||||
it('expect return a .user', function () {
|
|
||||||
expect(testGit.user).equal('pushrocks')
|
|
||||||
})
|
|
||||||
it('expect return a .repo', function () {
|
|
||||||
expect(testGit.repo).equal('smartstring')
|
|
||||||
})
|
|
||||||
it('expect return a .httpsUrl', function () {
|
|
||||||
expect(testGit.httpsUrl).equal('https://github.com/pushrocks/smartstring.git')
|
|
||||||
})
|
|
||||||
it('expect return a .sshUrl', function () {
|
|
||||||
expect(testGit.sshUrl).equal('git@github.com:pushrocks/smartstring.git')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
describe('.docker', function () {
|
|
||||||
describe('.makeEnvObject', function () {
|
|
||||||
it('expect create a Env Object', function () {
|
|
||||||
let envStringArray = [ 'VIRTUAL_HOST=sub.domain.tld', 'DEFAULT_HOST=some.domain.com' ]
|
|
||||||
let envObject: any = smartstring.docker.makeEnvObject(envStringArray)
|
|
||||||
expect(envObject.VIRTUAL_HOST).to.equal('sub.domain.tld')
|
|
||||||
expect(envObject.DEFAULT_HOST).to.equal('some.domain.com')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
describe('.indent', function () {
|
|
||||||
let testString = `
|
|
||||||
base
|
|
||||||
expect be indented
|
|
||||||
some more
|
|
||||||
|
|
||||||
base
|
|
||||||
indented
|
|
||||||
`
|
|
||||||
describe('.normalize()', function () {
|
|
||||||
it('expect normalize a string', function () {
|
|
||||||
testString = smartstring.indent.normalize(testString)
|
|
||||||
console.log(testString)
|
|
||||||
let zoneNameArg = 'test1'
|
|
||||||
let destinationIpArg = '111'
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('.indentWithPrefix', function () {
|
|
||||||
it('expect indent', function () {
|
|
||||||
testString = smartstring.indent.indentWithPrefix(testString, '>> ')
|
|
||||||
console.log(testString)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
describe('.typescript', function () {
|
|
||||||
describe('.referenceRegex', function () {
|
|
||||||
it('expect match reference paths', function () {
|
|
||||||
expect(
|
|
||||||
smartstring.typescript.regexReferencePath.test('/// <reference path=\"\" />')
|
|
||||||
).to.be.true
|
|
||||||
expect(
|
|
||||||
smartstring.typescript.regexReferencePath.test("/// <reference path='' />")
|
|
||||||
).to.be.true
|
|
||||||
expect(
|
|
||||||
smartstring.typescript.regexReferencePath.test('/// <referencepath=\"\" />')
|
|
||||||
).to.be.false
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
14
test/test.type.both.ts
Normal file
14
test/test.type.both.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { tap, expect } from '@push.rocks/tapbundle';
|
||||||
|
import * as smartstring from '../ts/index.js';
|
||||||
|
|
||||||
|
tap.test('should state valuid utf8', async () => {
|
||||||
|
expect(smartstring.type.isUtf8('hithere')).toBeTrue();
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('should state wether base64 string is valid', async () => {
|
||||||
|
const base64String = smartstring.base64.encode('hi there');
|
||||||
|
expect(smartstring.type.isBase64(base64String)).toBeTrue();
|
||||||
|
expect(smartstring.type.isBase64('hi there')).toBeFalse();
|
||||||
|
});
|
||||||
|
|
||||||
|
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: '@push.rocks/smartstring',
|
||||||
|
version: '4.0.15',
|
||||||
|
description: 'handle strings in smart ways. TypeScript ready.'
|
||||||
|
}
|
20
ts/index.ts
20
ts/index.ts
@ -1,13 +1,11 @@
|
|||||||
import * as docker from './smartstring.docker'
|
import * as create from './smartstring.create.js';
|
||||||
import * as indent from './smartstring.indent'
|
import * as docker from './smartstring.docker.js';
|
||||||
import * as typescript from './smartstring.typescript'
|
import * as indent from './smartstring.indent.js';
|
||||||
|
import * as normalize from './smartstring.normalize.js';
|
||||||
|
import * as type from './smartstring.type.js';
|
||||||
|
|
||||||
export {
|
export { create, docker, normalize, indent, type };
|
||||||
docker,
|
|
||||||
typescript,
|
|
||||||
indent
|
|
||||||
}
|
|
||||||
|
|
||||||
export { Base64, base64 } from './smartstring.base64'
|
export { Base64, base64 } from './smartstring.base64.js';
|
||||||
export { Domain } from './smartstring.domain'
|
export { Domain } from './smartstring.domain.js';
|
||||||
export { GitRepo } from './smartstring.git'
|
export { GitRepo } from './smartstring.git.js';
|
||||||
|
@ -1,69 +1,79 @@
|
|||||||
import * as plugins from './smartstring.plugins'
|
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;
|
||||||
break
|
break;
|
||||||
case 'base64':
|
case 'base64':
|
||||||
this.refString = base64.decode(inputStringArg)
|
this.refString = base64.decode(inputStringArg);
|
||||||
break
|
break;
|
||||||
case 'base64uri':
|
case 'base64uri':
|
||||||
this.refString = base64.decode(inputStringArg)
|
this.refString = base64.decode(inputStringArg);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the simple string (unencoded)
|
* the simple string (unencoded)
|
||||||
*/
|
*/
|
||||||
get simpleString() {
|
get simpleString() {
|
||||||
return this.refString
|
return this.refString;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the base64 encoded version of the original string
|
* the base64 encoded version of the original string
|
||||||
*/
|
*/
|
||||||
get base64String() {
|
get base64String() {
|
||||||
return base64.encode(this.refString)
|
return base64.encode(this.refString);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the base64uri encoded version of the original string
|
* the base64uri encoded version of the original string
|
||||||
*/
|
*/
|
||||||
get base64UriString() {
|
get base64UriString() {
|
||||||
return base64.encodeUri(this.refString)
|
return base64.encodeUri(this.refString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export let base64 = {
|
export let base64 = {
|
||||||
/**
|
/**
|
||||||
* encodes the string
|
* encodes the string
|
||||||
*/
|
*/
|
||||||
encode: (stringArg: string) => {
|
encode: (stringArg: string) => {
|
||||||
return plugins.jsBase64.encode(stringArg)
|
return plugins.jsBase64.encode(stringArg);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* encodes a stringArg to base64 uri style
|
* encodes a stringArg to base64 uri style
|
||||||
*/
|
*/
|
||||||
encodeUri: (stringArg: string) => {
|
encodeUri: (stringArg: string) => {
|
||||||
return plugins.jsBase64.encodeURI(stringArg)
|
return plugins.jsBase64.encodeURI(stringArg);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* decodes a base64 encoded string
|
* decodes a base64 encoded string
|
||||||
*/
|
*/
|
||||||
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);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
29
ts/smartstring.create.ts
Normal file
29
ts/smartstring.create.ts
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import * as plugins from './smartstring.plugins.js';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* creates a random string
|
||||||
|
*
|
||||||
|
* ```ts
|
||||||
|
* createRandomString('AAAA')
|
||||||
|
* //=> 'AGHR'
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param patternArg the pattern argument to use, Aa0!* are viable pattern descritors
|
||||||
|
* @param lengthArg the length of the random string
|
||||||
|
* @param optionsArg options
|
||||||
|
*/
|
||||||
|
export const createRandomString = (
|
||||||
|
patternArg: string,
|
||||||
|
lengthArg?: number,
|
||||||
|
optionsArg?: any
|
||||||
|
): string => {
|
||||||
|
return plugins.randomatic(patternArg, lengthArg, optionsArg);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* creates a crytic string in the speicifed length
|
||||||
|
* @param lengthArg the length of the crypto string
|
||||||
|
*/
|
||||||
|
export const createCryptoRandomString = (): string => {
|
||||||
|
return plugins.isounique.uni();
|
||||||
|
};
|
@ -1,18 +1,18 @@
|
|||||||
import * as plugins from './smartstring.plugins'
|
import * as plugins from './smartstring.plugins.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* converts an erray of env strings from docker remote api to an usable object.
|
* converts an erray of env strings from docker remote api to an usable object.
|
||||||
* @param envArrayArg
|
* @param envArrayArg
|
||||||
* @returns {}
|
* @returns {}
|
||||||
*/
|
*/
|
||||||
export let makeEnvObject = function (envArrayArg: string[]) {
|
export const makeEnvObject = function (envArrayArg: string[]) {
|
||||||
let returnObject = {}
|
let returnObject = {};
|
||||||
let regexString = /(.*)=(.*)/
|
let regexString = /(.*)=(.*)/;
|
||||||
if (typeof envArrayArg !== 'undefined') {
|
if (typeof envArrayArg !== 'undefined') {
|
||||||
for (let envKey in envArrayArg) {
|
for (let envKey in envArrayArg) {
|
||||||
let regexMatches = regexString.exec(envArrayArg[envKey])
|
let regexMatches = regexString.exec(envArrayArg[envKey]);
|
||||||
returnObject[regexMatches[1]] = regexMatches[2]
|
returnObject[regexMatches[1]] = regexMatches[2];
|
||||||
};
|
|
||||||
}
|
}
|
||||||
return returnObject
|
}
|
||||||
}
|
return returnObject;
|
||||||
|
};
|
||||||
|
@ -1,62 +1,87 @@
|
|||||||
import * as plugins from './smartstring.plugins';
|
import * as plugins from './smartstring.plugins.js';
|
||||||
|
|
||||||
export class Domain {
|
export class Domain {
|
||||||
fullName: string
|
public fullName: string;
|
||||||
level1: string
|
public level1: string;
|
||||||
level2: string
|
public level2: string;
|
||||||
level3: string
|
public level3: string;
|
||||||
level4: string
|
public level4: string;
|
||||||
level5: string
|
public level5: string;
|
||||||
protocol: string
|
public protocol: string;
|
||||||
zoneName: string
|
public zoneName: string;
|
||||||
|
// aliases
|
||||||
|
public topLevel: string;
|
||||||
|
public domainName;
|
||||||
|
public subDomain;
|
||||||
|
public port;
|
||||||
|
public nodeParsedUrl: plugins.url.UrlWithStringQuery;
|
||||||
|
constructor(domainStringArg: string) {
|
||||||
|
// lets do the node standard stuff first
|
||||||
|
this.protocol = this._protocolRegex(domainStringArg);
|
||||||
|
if (!this.protocol) {
|
||||||
|
domainStringArg = `https://${domainStringArg}`;
|
||||||
|
}
|
||||||
|
this.nodeParsedUrl = plugins.url.parse(domainStringArg);
|
||||||
|
this.port = this.nodeParsedUrl.port;
|
||||||
|
|
||||||
|
// lets do the rest after
|
||||||
|
const regexMatches = this._domainRegex(
|
||||||
|
domainStringArg.replace(this.nodeParsedUrl.pathname, '')
|
||||||
|
);
|
||||||
|
this.fullName = '';
|
||||||
|
for (let i = 1; i <= 5; i++) {
|
||||||
|
if (regexMatches[i - 1]) {
|
||||||
|
const localMatch = regexMatches[i - 1];
|
||||||
|
this['level' + i.toString()] = localMatch;
|
||||||
|
if (this.fullName === '') {
|
||||||
|
this.fullName = localMatch;
|
||||||
|
} else {
|
||||||
|
this.fullName = localMatch + '.' + this.fullName;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this['level' + i.toString()] = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.zoneName = this.level2 + '.' + this.level1;
|
||||||
|
|
||||||
// aliases
|
// aliases
|
||||||
topLevel: string
|
this.topLevel = this.level1;
|
||||||
domainName
|
this.domainName = this.level2;
|
||||||
subDomain
|
this.subDomain = this.level3;
|
||||||
constructor(domainStringArg:string){
|
}
|
||||||
let regexMatches = domainRegex(domainStringArg);
|
|
||||||
this.fullName = ''
|
|
||||||
for (let i = 1; i <= 5; i++) {
|
|
||||||
if (regexMatches[i - 1]) {
|
|
||||||
let localMatch = regexMatches[i - 1]
|
|
||||||
this['level' + i.toString()] = localMatch
|
|
||||||
if (this.fullName === ''){
|
|
||||||
this.fullName = localMatch
|
|
||||||
} else {
|
|
||||||
this.fullName = localMatch + '.' + this.fullName
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this['level' + i.toString()] = undefined
|
|
||||||
};
|
|
||||||
};
|
|
||||||
this.protocol = protocolRegex(domainStringArg)
|
|
||||||
this.zoneName = this.level2 + '.' + this.level1
|
|
||||||
|
|
||||||
// aliases
|
// helper functions
|
||||||
this.topLevel = this.level1
|
|
||||||
this.domainName = this.level2
|
|
||||||
this.subDomain = this.level3
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/** */
|
||||||
let domainRegex = function(stringArg:string){
|
private _domainRegex(stringArg: string) {
|
||||||
let regexString = /([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}$/
|
const regexString =
|
||||||
let regexMatches = regexString.exec(stringArg)
|
/([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}$/;
|
||||||
regexMatches.reverse() //make sure we build the domain from toplevel to subdomain (reversed order)
|
const regexMatches = regexString.exec(stringArg);
|
||||||
regexMatches.pop() // pop the last element, which is, since we reversed the Array, the full String of matched elements
|
regexMatches.reverse(); //make sure we build the domain from toplevel to subdomain (reversed order)
|
||||||
let regexMatchesFiltered = regexMatches.filter(function(stringArg:string){
|
regexMatches.pop(); // pop the last element, which is, since we reversed the Array, the full String of matched elements
|
||||||
return(stringArg !== '')
|
const regexMatchesFiltered = regexMatches.filter(function (stringArg: string) {
|
||||||
|
return stringArg !== '';
|
||||||
});
|
});
|
||||||
return regexMatchesFiltered
|
return regexMatchesFiltered;
|
||||||
};
|
}
|
||||||
|
|
||||||
let protocolRegex = function(stringArg:string){
|
private _protocolRegex(stringArg: string) {
|
||||||
let regexString = /^([a-zA-Z0-9]*):\/\//
|
const regexString = /^([a-zA-Z0-9]*):\/\//;
|
||||||
let regexMatches = regexString.exec(stringArg)
|
const regexMatches = regexString.exec(stringArg);
|
||||||
if(regexMatches) {
|
if (regexMatches) {
|
||||||
return regexMatches[1]
|
return regexMatches[1];
|
||||||
} else {
|
} else {
|
||||||
return undefined
|
return undefined;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private _portRegex(stringArg: string) {
|
||||||
|
const regexString = /^([a-zA-Z0-9]*):\/\//;
|
||||||
|
const regexMatches = regexString.exec(stringArg);
|
||||||
|
if (regexMatches) {
|
||||||
|
return regexMatches[1];
|
||||||
|
} else {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,52 +1,57 @@
|
|||||||
import * as plugins from './smartstring.plugins'
|
import * as plugins from './smartstring.plugins.js';
|
||||||
|
|
||||||
/* ---------------------------------------------- *
|
/* ---------------------------------------------- *
|
||||||
* ------------------ classes ------------------- *
|
* ------------------ classes ------------------- *
|
||||||
* ---------------------------------------------- */
|
* ---------------------------------------------- */
|
||||||
export class GitRepo {
|
export class GitRepo {
|
||||||
host: string
|
host: string;
|
||||||
user: string
|
user: string;
|
||||||
repo: string
|
repo: string;
|
||||||
accessToken: string
|
accessToken: string;
|
||||||
sshUrl: string
|
sshUrl: string;
|
||||||
httpsUrl: string
|
httpsUrl: string;
|
||||||
constructor(stringArg: string,tokenArg?: string) {
|
constructor(stringArg: string, tokenArg?: string) {
|
||||||
let regexMatches = gitRegex(stringArg)
|
let regexMatches = gitRegex(stringArg);
|
||||||
this.host = regexMatches[1]
|
this.host = regexMatches[1];
|
||||||
this.user = regexMatches[2]
|
this.user = regexMatches[2];
|
||||||
this.repo = regexMatches[3]
|
this.repo = regexMatches[3];
|
||||||
this.accessToken = tokenArg
|
this.accessToken = tokenArg;
|
||||||
this.sshUrl = gitLink(this.host,this.user,this.repo,this.accessToken, 'ssh')
|
this.sshUrl = gitLink(this.host, this.user, this.repo, this.accessToken, 'ssh');
|
||||||
this.httpsUrl = gitLink(this.host,this.user,this.repo,this.accessToken, 'https')
|
this.httpsUrl = gitLink(this.host, this.user, this.repo, this.accessToken, 'https');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------- *
|
/* ---------------------------------------------- *
|
||||||
* ------------------ helpers ------------------- *
|
* ------------------ helpers ------------------- *
|
||||||
* ---------------------------------------------- */
|
* ---------------------------------------------- */
|
||||||
let gitRegex = function(stringArg:string){
|
const gitRegex = function (stringArg: string) {
|
||||||
let regexString = /([a-zA-Z0-9\-\.]*)(?:\/|\:)([a-zA-Z0-9\-\.]*)(?:\/)([a-zA-Z0-9\-\.]*)(?:\.git)/
|
const regexString =
|
||||||
let regexMatches = regexString.exec(stringArg)
|
/([a-zA-Z0-9\-_\.]*)(?:\/|\:)([a-zA-Z0-9\-_\.]*)(?:\/)([a-zA-Z0-9\-_\.]*)(?:\.git)/;
|
||||||
return regexMatches
|
let regexMatches = regexString.exec(stringArg);
|
||||||
}
|
return regexMatches;
|
||||||
|
};
|
||||||
|
|
||||||
let gitLink = function(hostArg: string, userArg: string, repoArg: string, tokenArg: string = '', linkTypeArg): string{
|
const gitLink = function (
|
||||||
let returnString
|
hostArg: string,
|
||||||
if (tokenArg !== '') {
|
userArg: string,
|
||||||
tokenArg = tokenArg + '@'
|
repoArg: string,
|
||||||
}
|
tokenArg: string = '',
|
||||||
switch (linkTypeArg) {
|
linkTypeArg
|
||||||
case 'https':
|
): string {
|
||||||
returnString = 'https://' +
|
let returnString;
|
||||||
tokenArg + hostArg + '/' + userArg + '/' + repoArg + '.git'
|
if (tokenArg !== '') {
|
||||||
break
|
tokenArg = tokenArg + '@';
|
||||||
case 'ssh':
|
}
|
||||||
returnString = 'git@' +
|
switch (linkTypeArg) {
|
||||||
hostArg + ':' + userArg + '/' + repoArg + '.git';
|
case 'https':
|
||||||
break
|
returnString = 'https://' + tokenArg + hostArg + '/' + userArg + '/' + repoArg + '.git';
|
||||||
default:
|
break;
|
||||||
console.error('Link Type ' + linkTypeArg + ' not known')
|
case 'ssh':
|
||||||
break
|
returnString = 'git@' + hostArg + ':' + userArg + '/' + repoArg + '.git';
|
||||||
}
|
break;
|
||||||
return returnString
|
default:
|
||||||
}
|
console.error('Link Type ' + linkTypeArg + ' not known');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return returnString;
|
||||||
|
};
|
||||||
|
@ -1,64 +1,92 @@
|
|||||||
import * as plugins from './smartstring.plugins'
|
import * as plugins from './smartstring.plugins.js';
|
||||||
|
|
||||||
let splitString = (stringArg: string): string[] => {
|
/**
|
||||||
let resultArray = stringArg.split('\n')
|
* splits a string into an array
|
||||||
return cleanStringArray(resultArray)
|
* @param stringArg
|
||||||
|
*/
|
||||||
|
const splitStringAtLineBreak = (stringArg: string): string[] => {
|
||||||
|
let resultArray = stringArg.split('\n');
|
||||||
|
return cleanStringArray(resultArray);
|
||||||
};
|
};
|
||||||
|
|
||||||
let joinString = (stringArrayArg: string[]): string => {
|
/**
|
||||||
let resultString: string = ''
|
* joins a string together again
|
||||||
for (let line of stringArrayArg){
|
* @param stringArrayArg
|
||||||
resultString = resultString + line + '\n'
|
*/
|
||||||
|
const joinStringWithLineBreaks = (stringArrayArg: string[]): string => {
|
||||||
|
let resultString: string = '';
|
||||||
|
for (let line of stringArrayArg) {
|
||||||
|
resultString = resultString + line + '\n'; // add new line at end
|
||||||
|
}
|
||||||
|
return resultString;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cleans first and last line in case they are empty
|
||||||
|
* @param stringArrayArg
|
||||||
|
*/
|
||||||
|
const cleanStringArray = (stringArrayArg: string[]): string[] => {
|
||||||
|
let testRegex = /^[\s]*$/;
|
||||||
|
if (testRegex.test(stringArrayArg[0])) {
|
||||||
|
stringArrayArg.shift();
|
||||||
|
}
|
||||||
|
if (testRegex.test(stringArrayArg[stringArrayArg.length - 1])) {
|
||||||
|
stringArrayArg.pop();
|
||||||
|
}
|
||||||
|
return stringArrayArg;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* indent an array
|
||||||
|
* @param stringArg
|
||||||
|
* @param spaceAmount
|
||||||
|
*/
|
||||||
|
export const indent = (stringArg: string, spaceAmount: number): string => {
|
||||||
|
let localStringArray = splitStringAtLineBreak(stringArg);
|
||||||
|
for (let stringArg of localStringArray) {
|
||||||
|
stringArg = ' '.repeat(spaceAmount) + stringArg;
|
||||||
|
}
|
||||||
|
let resultString = joinStringWithLineBreaks(localStringArray);
|
||||||
|
return resultString;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* indents a string with prefix
|
||||||
|
* @param stringArg
|
||||||
|
* @param prefixArg
|
||||||
|
*/
|
||||||
|
export const indentWithPrefix = (stringArg: string, prefixArg: string): string => {
|
||||||
|
let resultString: string;
|
||||||
|
let stringArray = splitStringAtLineBreak(stringArg);
|
||||||
|
let resultArray: string[] = [];
|
||||||
|
for (let stringItem of stringArray) {
|
||||||
|
resultArray.push(prefixArg + stringItem);
|
||||||
|
}
|
||||||
|
resultString = joinStringWithLineBreaks(resultArray);
|
||||||
|
return resultString;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const normalize = (stringArg: string): string => {
|
||||||
|
let resultString: string;
|
||||||
|
let splitStringArray: string[] = splitStringAtLineBreak(stringArg);
|
||||||
|
let minCommonLeftOffset: number;
|
||||||
|
|
||||||
|
const deIndentRegex = /^(\s*)/;
|
||||||
|
const emptyLineRegex = /^(\s*)$/;
|
||||||
|
|
||||||
|
for (let stringItem of splitStringArray) {
|
||||||
|
let offsetString = deIndentRegex.exec(stringItem)[1];
|
||||||
|
if (
|
||||||
|
(typeof minCommonLeftOffset === 'undefined' || offsetString.length < minCommonLeftOffset) &&
|
||||||
|
!emptyLineRegex.test(stringItem)
|
||||||
|
) {
|
||||||
|
minCommonLeftOffset = offsetString.length;
|
||||||
}
|
}
|
||||||
return resultString
|
}
|
||||||
}
|
let resultSplitStringArray = [];
|
||||||
|
for (let stringItem of splitStringArray) {
|
||||||
let cleanStringArray = (stringArrayArg: string[]): string[] => {
|
resultSplitStringArray.push(stringItem.substr(minCommonLeftOffset));
|
||||||
let testRegex = /^[\s]*$/
|
}
|
||||||
if (testRegex.test(stringArrayArg[0])) {
|
resultString = joinStringWithLineBreaks(resultSplitStringArray);
|
||||||
stringArrayArg.shift()
|
return resultString;
|
||||||
}
|
};
|
||||||
if (testRegex.test(stringArrayArg[stringArrayArg.length - 1])) {
|
|
||||||
stringArrayArg.pop()
|
|
||||||
};
|
|
||||||
return stringArrayArg
|
|
||||||
}
|
|
||||||
|
|
||||||
export let indent = (stringArg: string, spaceAmount: number): string => {
|
|
||||||
let resultString: string
|
|
||||||
return resultString
|
|
||||||
}
|
|
||||||
|
|
||||||
export let indentWithPrefix = (stringArg: string,prefixArg: string): string => {
|
|
||||||
let resultString: string
|
|
||||||
let stringArray = splitString(stringArg)
|
|
||||||
let resultArray: string[] = []
|
|
||||||
for (let stringItem of stringArray){
|
|
||||||
resultArray.push(prefixArg + stringItem)
|
|
||||||
};
|
|
||||||
resultString = joinString(resultArray)
|
|
||||||
return resultString
|
|
||||||
}
|
|
||||||
|
|
||||||
export let normalize = (stringArg: string): string => {
|
|
||||||
let resultString: string
|
|
||||||
let splitStringArray: string[] = splitString(stringArg)
|
|
||||||
let minCommonLeftOffset: number
|
|
||||||
let deIndentRegex = /^(\s*)/
|
|
||||||
let emptyLineRegex = /^(\s*)$/
|
|
||||||
for (let stringItem of splitStringArray){
|
|
||||||
let offsetString = deIndentRegex.exec(stringItem)[1]
|
|
||||||
if (
|
|
||||||
(typeof minCommonLeftOffset === 'undefined' || offsetString.length < minCommonLeftOffset)
|
|
||||||
&& !emptyLineRegex.test(stringItem)
|
|
||||||
) {
|
|
||||||
minCommonLeftOffset = offsetString.length
|
|
||||||
}
|
|
||||||
};
|
|
||||||
let resultSplitStringArray = []
|
|
||||||
for (let stringItem of splitStringArray) {
|
|
||||||
resultSplitStringArray.push(stringItem.substr(minCommonLeftOffset))
|
|
||||||
};
|
|
||||||
resultString = joinString(resultSplitStringArray)
|
|
||||||
return resultString
|
|
||||||
}
|
|
||||||
|
51
ts/smartstring.normalize.ts
Normal file
51
ts/smartstring.normalize.ts
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
import * as plugins from './smartstring.plugins.js';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* replaces all occurences of something in a string
|
||||||
|
* @param stringArg
|
||||||
|
* @param searchPattern
|
||||||
|
* @param replacementString
|
||||||
|
*/
|
||||||
|
export const replaceAll = (stringArg: string, searchPattern: string, replacementString: string) => {
|
||||||
|
return stringArg.replace(new RegExp(searchPattern, 'g'), replacementString);
|
||||||
|
};
|
||||||
|
|
||||||
|
export interface INormalizeOptions {
|
||||||
|
stripLeadingTrailingEmptyLines?: boolean;
|
||||||
|
stripAllEmptyLines?: boolean;
|
||||||
|
stripIndent?: boolean;
|
||||||
|
normalizeNewline?: boolean;
|
||||||
|
replaceTabs?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalizes a string
|
||||||
|
* @param stringArg
|
||||||
|
* @param options
|
||||||
|
*/
|
||||||
|
export const standard = (stringArg: string, options?: INormalizeOptions): string => {
|
||||||
|
let result = stringArg;
|
||||||
|
|
||||||
|
if (!options || options.stripIndent) {
|
||||||
|
result = plugins.stripIndent(result); // fix indention
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!options || options.normalizeNewline) {
|
||||||
|
result = result.replace(/\r\n/g, '\n'); // fix newlines
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!options || options.replaceTabs) {
|
||||||
|
result = replaceAll(result, '\t/', ' '); // fix tabs
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!options || options.stripLeadingTrailingEmptyLines) {
|
||||||
|
result = result.replace(/^\s*[\r\n]/gm, '').replace(/\s*[\r\n]$/gm, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!options || options.stripAllEmptyLines) {
|
||||||
|
result = result.replace(/^\s*[\r\n]/gm, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
@ -1,2 +1,17 @@
|
|||||||
import 'typings-global'
|
// node native
|
||||||
export let jsBase64 = require('js-base64').Base64
|
import * as smartenv from '@push.rocks/smartenv';
|
||||||
|
const smartenvInstance = new smartenv.Smartenv();
|
||||||
|
import * as isounique from '@push.rocks/isounique';
|
||||||
|
|
||||||
|
export { isounique };
|
||||||
|
|
||||||
|
import * as url from 'url';
|
||||||
|
export { url };
|
||||||
|
|
||||||
|
// third party
|
||||||
|
import { Base64 as jsBase64 } from 'js-base64';
|
||||||
|
|
||||||
|
import stripIndent from 'strip-indent';
|
||||||
|
import randomatic from 'randomatic';
|
||||||
|
|
||||||
|
export { jsBase64, stripIndent, randomatic };
|
||||||
|
108
ts/smartstring.type.ts
Normal file
108
ts/smartstring.type.ts
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
import * as plugins from './smartstring.plugins.js';
|
||||||
|
import * as base64 from './smartstring.base64.js';
|
||||||
|
|
||||||
|
export const isUtf8 = (stringArg: string): boolean => {
|
||||||
|
// Convert string to a Uint8Array. In browsers, this will be a bit more complex
|
||||||
|
// because we need to convert the string to a binary representation first.
|
||||||
|
const encoder = new TextEncoder();
|
||||||
|
const bytes = encoder.encode(stringArg);
|
||||||
|
|
||||||
|
let i = 0;
|
||||||
|
while (i < bytes.length) {
|
||||||
|
if (
|
||||||
|
// ASCII
|
||||||
|
bytes[i] === 0x09 ||
|
||||||
|
bytes[i] === 0x0a ||
|
||||||
|
bytes[i] === 0x0d ||
|
||||||
|
(0x20 <= bytes[i] && bytes[i] <= 0x7e)
|
||||||
|
) {
|
||||||
|
i += 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
// non-overlong 2-byte
|
||||||
|
0xc2 <= bytes[i] &&
|
||||||
|
bytes[i] <= 0xdf &&
|
||||||
|
0x80 <= bytes[i + 1] &&
|
||||||
|
bytes[i + 1] <= 0xbf
|
||||||
|
) {
|
||||||
|
i += 2;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
// excluding overlongs
|
||||||
|
(bytes[i] === 0xe0 &&
|
||||||
|
0xa0 <= bytes[i + 1] &&
|
||||||
|
bytes[i + 1] <= 0xbf &&
|
||||||
|
0x80 <= bytes[i + 2] &&
|
||||||
|
bytes[i + 2] <= 0xbf) ||
|
||||||
|
// straight 3-byte
|
||||||
|
(((0xe1 <= bytes[i] && bytes[i] <= 0xec) || bytes[i] === 0xee || bytes[i] === 0xef) &&
|
||||||
|
0x80 <= bytes[i + 1] &&
|
||||||
|
bytes[i + 1] <= 0xbf &&
|
||||||
|
0x80 <= bytes[i + 2] &&
|
||||||
|
bytes[i + 2] <= 0xbf) ||
|
||||||
|
// excluding surrogates
|
||||||
|
(bytes[i] === 0xed &&
|
||||||
|
0x80 <= bytes[i + 1] &&
|
||||||
|
bytes[i + 1] <= 0x9f &&
|
||||||
|
0x80 <= bytes[i + 2] &&
|
||||||
|
bytes[i + 2] <= 0xbf)
|
||||||
|
) {
|
||||||
|
i += 3;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
// planes 1-3
|
||||||
|
(bytes[i] === 0xf0 &&
|
||||||
|
0x90 <= bytes[i + 1] &&
|
||||||
|
bytes[i + 1] <= 0xbf &&
|
||||||
|
0x80 <= bytes[i + 2] &&
|
||||||
|
bytes[i + 2] <= 0xbf &&
|
||||||
|
0x80 <= bytes[i + 3] &&
|
||||||
|
bytes[i + 3] <= 0xbf) ||
|
||||||
|
// planes 4-15
|
||||||
|
(0xf1 <= bytes[i] &&
|
||||||
|
bytes[i] <= 0xf3 &&
|
||||||
|
0x80 <= bytes[i + 1] &&
|
||||||
|
bytes[i + 1] <= 0xbf &&
|
||||||
|
0x80 <= bytes[i + 2] &&
|
||||||
|
bytes[i + 2] <= 0xbf &&
|
||||||
|
0x80 <= bytes[i + 3] &&
|
||||||
|
bytes[i + 3] <= 0xbf) ||
|
||||||
|
// plane 16
|
||||||
|
(bytes[i] === 0xf4 &&
|
||||||
|
0x80 <= bytes[i + 1] &&
|
||||||
|
bytes[i + 1] <= 0x8f &&
|
||||||
|
0x80 <= bytes[i + 2] &&
|
||||||
|
bytes[i + 2] <= 0xbf &&
|
||||||
|
0x80 <= bytes[i + 3] &&
|
||||||
|
bytes[i + 3] <= 0xbf)
|
||||||
|
) {
|
||||||
|
i += 4;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
export const isBase64 = (stringArg: string) => {
|
||||||
|
const notBase64 = /[^A-Z0-9+\/=]/i;
|
||||||
|
const len = stringArg.length;
|
||||||
|
if (!len || len % 4 !== 0 || notBase64.test(stringArg)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const firstPaddingChar = stringArg.indexOf('=');
|
||||||
|
return (
|
||||||
|
firstPaddingChar === -1 ||
|
||||||
|
firstPaddingChar === len - 1 ||
|
||||||
|
(firstPaddingChar === len - 2 && stringArg[len - 1] === '=')
|
||||||
|
);
|
||||||
|
};
|
@ -1,3 +0,0 @@
|
|||||||
import * as plugins from './smartstring.plugins'
|
|
||||||
|
|
||||||
export let regexReferencePath = /\/\/\/\s*<reference\s+path\s*=\s*["|'].*["|']\s*\/>\s*[\\n]?/
|
|
14
tsconfig.json
Normal file
14
tsconfig.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"useDefineForClassFields": false,
|
||||||
|
"target": "ES2022",
|
||||||
|
"module": "NodeNext",
|
||||||
|
"moduleResolution": "NodeNext",
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"verbatimModuleSyntax": true
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"dist_*/**/*.d.ts"
|
||||||
|
]
|
||||||
|
}
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "tslint-config-standard"
|
|
||||||
}
|
|
351
yarn.lock
351
yarn.lock
@ -1,351 +0,0 @@
|
|||||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
||||||
# yarn lockfile v1
|
|
||||||
|
|
||||||
|
|
||||||
"@types/chai-as-promised@0.0.29":
|
|
||||||
version "0.0.29"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/chai-as-promised/-/chai-as-promised-0.0.29.tgz#43d52892aa998e185a3de3e2477edb8573be1d77"
|
|
||||||
dependencies:
|
|
||||||
"@types/chai" "*"
|
|
||||||
"@types/promises-a-plus" "*"
|
|
||||||
|
|
||||||
"@types/chai-string@^1.1.30":
|
|
||||||
version "1.1.30"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/chai-string/-/chai-string-1.1.30.tgz#4d8744b31a5a2295fc01c981ed1e2d4c8a070f0a"
|
|
||||||
dependencies:
|
|
||||||
"@types/chai" "*"
|
|
||||||
|
|
||||||
"@types/chai@*", "@types/chai@^3.4.35":
|
|
||||||
version "3.4.35"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-3.4.35.tgz#e8d65f83492d2944f816fc620741821c28a8c900"
|
|
||||||
|
|
||||||
"@types/lodash@4.x.x":
|
|
||||||
version "4.14.52"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.52.tgz#de5c7ab14da1289733233c9b0ec6f9e377db90f5"
|
|
||||||
|
|
||||||
"@types/mocha@^2.2.31":
|
|
||||||
version "2.2.39"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-2.2.39.tgz#f68d63db8b69c38e9558b4073525cf96c4f7a829"
|
|
||||||
|
|
||||||
"@types/node@*":
|
|
||||||
version "7.0.5"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.5.tgz#96a0f0a618b7b606f1ec547403c00650210bfbb7"
|
|
||||||
|
|
||||||
"@types/promises-a-plus@*":
|
|
||||||
version "0.0.27"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/promises-a-plus/-/promises-a-plus-0.0.27.tgz#c64651134614c84b8f5d7114ce8901d36a609780"
|
|
||||||
|
|
||||||
"@types/q@0.x.x":
|
|
||||||
version "0.0.32"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/q/-/q-0.0.32.tgz#bd284e57c84f1325da702babfc82a5328190c0c5"
|
|
||||||
|
|
||||||
"@types/shelljs@^0.3.33":
|
|
||||||
version "0.3.33"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/shelljs/-/shelljs-0.3.33.tgz#df613bddb88225ed09ce5c835f620dcaaf155e6b"
|
|
||||||
dependencies:
|
|
||||||
"@types/node" "*"
|
|
||||||
|
|
||||||
ansi-256-colors@^1.1.0:
|
|
||||||
version "1.1.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/ansi-256-colors/-/ansi-256-colors-1.1.0.tgz#910de50efcc7c09e3d82f2f87abd6b700c18818a"
|
|
||||||
|
|
||||||
ansi-regex@^2.0.0:
|
|
||||||
version "2.1.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
|
|
||||||
|
|
||||||
ansi-styles@^2.2.1:
|
|
||||||
version "2.2.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe"
|
|
||||||
|
|
||||||
assertion-error@^1.0.1:
|
|
||||||
version "1.0.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.0.2.tgz#13ca515d86206da0bac66e834dd397d87581094c"
|
|
||||||
|
|
||||||
balanced-match@^0.4.1:
|
|
||||||
version "0.4.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.4.2.tgz#cb3f3e3c732dc0f01ee70b403f302e61d7709838"
|
|
||||||
|
|
||||||
beautycolor@^1.0.5:
|
|
||||||
version "1.0.7"
|
|
||||||
resolved "https://registry.yarnpkg.com/beautycolor/-/beautycolor-1.0.7.tgz#a4715738ac4c8221371e9cbeb5a6cc6d11ecbf7c"
|
|
||||||
dependencies:
|
|
||||||
ansi-256-colors "^1.1.0"
|
|
||||||
typings-global "^1.0.14"
|
|
||||||
|
|
||||||
beautylog@^6.1.1:
|
|
||||||
version "6.1.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/beautylog/-/beautylog-6.1.1.tgz#2a83603ad7e2a0a09701ac63d7d3064a588dc779"
|
|
||||||
dependencies:
|
|
||||||
"@types/lodash" "4.x.x"
|
|
||||||
beautycolor "^1.0.5"
|
|
||||||
figlet "^1.2.0"
|
|
||||||
lodash "^4.17.4"
|
|
||||||
ora "^1.1.0"
|
|
||||||
smartenv "^2.0.0"
|
|
||||||
smartq "^1.0.4"
|
|
||||||
typings-global "^1.0.14"
|
|
||||||
|
|
||||||
brace-expansion@^1.0.0:
|
|
||||||
version "1.1.6"
|
|
||||||
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.6.tgz#7197d7eaa9b87e648390ea61fc66c84427420df9"
|
|
||||||
dependencies:
|
|
||||||
balanced-match "^0.4.1"
|
|
||||||
concat-map "0.0.1"
|
|
||||||
|
|
||||||
chai-as-promised@^6.0.0:
|
|
||||||
version "6.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/chai-as-promised/-/chai-as-promised-6.0.0.tgz#1a02a433a6f24dafac63b9c96fa1684db1aa8da6"
|
|
||||||
dependencies:
|
|
||||||
check-error "^1.0.2"
|
|
||||||
|
|
||||||
chai-string@^1.3.0:
|
|
||||||
version "1.3.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/chai-string/-/chai-string-1.3.0.tgz#df6139f294391b1035be5606f60a843b3a5041e7"
|
|
||||||
|
|
||||||
chai@^3.5.0:
|
|
||||||
version "3.5.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/chai/-/chai-3.5.0.tgz#4d02637b067fe958bdbfdd3a40ec56fef7373247"
|
|
||||||
dependencies:
|
|
||||||
assertion-error "^1.0.1"
|
|
||||||
deep-eql "^0.1.3"
|
|
||||||
type-detect "^1.0.0"
|
|
||||||
|
|
||||||
chalk@^1.0.0, chalk@^1.1.1:
|
|
||||||
version "1.1.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98"
|
|
||||||
dependencies:
|
|
||||||
ansi-styles "^2.2.1"
|
|
||||||
escape-string-regexp "^1.0.2"
|
|
||||||
has-ansi "^2.0.0"
|
|
||||||
strip-ansi "^3.0.0"
|
|
||||||
supports-color "^2.0.0"
|
|
||||||
|
|
||||||
check-error@^1.0.2:
|
|
||||||
version "1.0.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82"
|
|
||||||
|
|
||||||
cli-cursor@^2.1.0:
|
|
||||||
version "2.1.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5"
|
|
||||||
dependencies:
|
|
||||||
restore-cursor "^2.0.0"
|
|
||||||
|
|
||||||
cli-spinners@^1.0.0:
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-1.0.0.tgz#ef987ed3d48391ac3dab9180b406a742180d6e6a"
|
|
||||||
|
|
||||||
concat-map@0.0.1:
|
|
||||||
version "0.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
|
|
||||||
|
|
||||||
deep-eql@^0.1.3:
|
|
||||||
version "0.1.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-0.1.3.tgz#ef558acab8de25206cd713906d74e56930eb69f2"
|
|
||||||
dependencies:
|
|
||||||
type-detect "0.1.1"
|
|
||||||
|
|
||||||
escape-string-regexp@^1.0.2:
|
|
||||||
version "1.0.5"
|
|
||||||
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
|
|
||||||
|
|
||||||
figlet@^1.2.0:
|
|
||||||
version "1.2.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/figlet/-/figlet-1.2.0.tgz#6c46537378fab649146b5a6143dda019b430b410"
|
|
||||||
|
|
||||||
fs.realpath@^1.0.0:
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
|
|
||||||
|
|
||||||
glob@^7.0.0:
|
|
||||||
version "7.1.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8"
|
|
||||||
dependencies:
|
|
||||||
fs.realpath "^1.0.0"
|
|
||||||
inflight "^1.0.4"
|
|
||||||
inherits "2"
|
|
||||||
minimatch "^3.0.2"
|
|
||||||
once "^1.3.0"
|
|
||||||
path-is-absolute "^1.0.0"
|
|
||||||
|
|
||||||
has-ansi@^2.0.0:
|
|
||||||
version "2.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91"
|
|
||||||
dependencies:
|
|
||||||
ansi-regex "^2.0.0"
|
|
||||||
|
|
||||||
inflight@^1.0.4:
|
|
||||||
version "1.0.6"
|
|
||||||
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
|
|
||||||
dependencies:
|
|
||||||
once "^1.3.0"
|
|
||||||
wrappy "1"
|
|
||||||
|
|
||||||
inherits@2:
|
|
||||||
version "2.0.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
|
|
||||||
|
|
||||||
interpret@^1.0.0:
|
|
||||||
version "1.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.1.tgz#d579fb7f693b858004947af39fa0db49f795602c"
|
|
||||||
|
|
||||||
js-base64@^2.1.9:
|
|
||||||
version "2.1.9"
|
|
||||||
resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.1.9.tgz#f0e80ae039a4bd654b5f281fc93f04a914a7fcce"
|
|
||||||
|
|
||||||
lodash@^4.17.2, lodash@^4.17.4:
|
|
||||||
version "4.17.4"
|
|
||||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
|
|
||||||
|
|
||||||
log-symbols@^1.0.2:
|
|
||||||
version "1.0.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-1.0.2.tgz#376ff7b58ea3086a0f09facc74617eca501e1a18"
|
|
||||||
dependencies:
|
|
||||||
chalk "^1.0.0"
|
|
||||||
|
|
||||||
mimic-fn@^1.0.0:
|
|
||||||
version "1.1.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.1.0.tgz#e667783d92e89dbd342818b5230b9d62a672ad18"
|
|
||||||
|
|
||||||
minimatch@^3.0.2:
|
|
||||||
version "3.0.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774"
|
|
||||||
dependencies:
|
|
||||||
brace-expansion "^1.0.0"
|
|
||||||
|
|
||||||
npmts-g@^6.0.0:
|
|
||||||
version "6.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/npmts-g/-/npmts-g-6.0.0.tgz#491fd50f110967f1b68f14237e7ea5157bf4ddb3"
|
|
||||||
dependencies:
|
|
||||||
"@types/shelljs" "^0.3.33"
|
|
||||||
semver "^5.3.0"
|
|
||||||
shelljs "^0.7.5"
|
|
||||||
typings-global "^1.0.14"
|
|
||||||
|
|
||||||
once@^1.3.0:
|
|
||||||
version "1.4.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
|
|
||||||
dependencies:
|
|
||||||
wrappy "1"
|
|
||||||
|
|
||||||
onetime@^2.0.0:
|
|
||||||
version "2.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.0.tgz#52aa8110e52fc5126ffc667bd8ec21c2ed209ce6"
|
|
||||||
dependencies:
|
|
||||||
mimic-fn "^1.0.0"
|
|
||||||
|
|
||||||
ora@^1.1.0:
|
|
||||||
version "1.1.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/ora/-/ora-1.1.0.tgz#69aaa4a209630e43b142c5f7ff41820da87e2faf"
|
|
||||||
dependencies:
|
|
||||||
chalk "^1.1.1"
|
|
||||||
cli-cursor "^2.1.0"
|
|
||||||
cli-spinners "^1.0.0"
|
|
||||||
log-symbols "^1.0.2"
|
|
||||||
|
|
||||||
path-is-absolute@^1.0.0:
|
|
||||||
version "1.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
|
|
||||||
|
|
||||||
q@^1.4.1:
|
|
||||||
version "1.4.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/q/-/q-1.4.1.tgz#55705bcd93c5f3673530c2c2cbc0c2b3addc286e"
|
|
||||||
|
|
||||||
rechoir@^0.6.2:
|
|
||||||
version "0.6.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384"
|
|
||||||
dependencies:
|
|
||||||
resolve "^1.1.6"
|
|
||||||
|
|
||||||
resolve@^1.1.6:
|
|
||||||
version "1.2.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.2.0.tgz#9589c3f2f6149d1417a40becc1663db6ec6bc26c"
|
|
||||||
|
|
||||||
restore-cursor@^2.0.0:
|
|
||||||
version "2.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf"
|
|
||||||
dependencies:
|
|
||||||
onetime "^2.0.0"
|
|
||||||
signal-exit "^3.0.2"
|
|
||||||
|
|
||||||
semver@^5.3.0:
|
|
||||||
version "5.3.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f"
|
|
||||||
|
|
||||||
shelljs@^0.7.4, shelljs@^0.7.5:
|
|
||||||
version "0.7.6"
|
|
||||||
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.6.tgz#379cccfb56b91c8601e4793356eb5382924de9ad"
|
|
||||||
dependencies:
|
|
||||||
glob "^7.0.0"
|
|
||||||
interpret "^1.0.0"
|
|
||||||
rechoir "^0.6.2"
|
|
||||||
|
|
||||||
signal-exit@^3.0.2:
|
|
||||||
version "3.0.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"
|
|
||||||
|
|
||||||
smartchai@^1.0.3:
|
|
||||||
version "1.0.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/smartchai/-/smartchai-1.0.3.tgz#de6d010bb8b5aef24cb70b31a5f5334e8c41b72f"
|
|
||||||
dependencies:
|
|
||||||
"@types/chai" "^3.4.35"
|
|
||||||
"@types/chai-as-promised" "0.0.29"
|
|
||||||
"@types/chai-string" "^1.1.30"
|
|
||||||
chai "^3.5.0"
|
|
||||||
chai-as-promised "^6.0.0"
|
|
||||||
chai-string "^1.3.0"
|
|
||||||
|
|
||||||
smartenv@^2.0.0:
|
|
||||||
version "2.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/smartenv/-/smartenv-2.0.0.tgz#ede4e2044efcf9bec318388bb1dab53024ee3d16"
|
|
||||||
dependencies:
|
|
||||||
"@types/q" "0.x.x"
|
|
||||||
lodash "^4.17.2"
|
|
||||||
q "^1.4.1"
|
|
||||||
typings-global "^1.0.14"
|
|
||||||
|
|
||||||
smartq@^1.0.4:
|
|
||||||
version "1.1.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/smartq/-/smartq-1.1.1.tgz#efb358705260d41ae18aef7ffd815f7b6fe17dd3"
|
|
||||||
dependencies:
|
|
||||||
typed-promisify "^0.3.0"
|
|
||||||
typings-global "^1.0.14"
|
|
||||||
|
|
||||||
strip-ansi@^3.0.0:
|
|
||||||
version "3.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf"
|
|
||||||
dependencies:
|
|
||||||
ansi-regex "^2.0.0"
|
|
||||||
|
|
||||||
supports-color@^2.0.0:
|
|
||||||
version "2.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
|
|
||||||
|
|
||||||
type-detect@0.1.1:
|
|
||||||
version "0.1.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-0.1.1.tgz#0ba5ec2a885640e470ea4e8505971900dac58822"
|
|
||||||
|
|
||||||
type-detect@^1.0.0:
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-1.0.0.tgz#762217cc06db258ec48908a1298e8b95121e8ea2"
|
|
||||||
|
|
||||||
typed-promisify@^0.3.0:
|
|
||||||
version "0.3.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/typed-promisify/-/typed-promisify-0.3.0.tgz#1ba0af5e444c87d8047406f18ce49092a1191853"
|
|
||||||
|
|
||||||
typings-global@*, typings-global@^1.0.14:
|
|
||||||
version "1.0.14"
|
|
||||||
resolved "https://registry.yarnpkg.com/typings-global/-/typings-global-1.0.14.tgz#ab682720a03d6b9278869fb5c30c30d7dc61d12c"
|
|
||||||
dependencies:
|
|
||||||
semver "^5.3.0"
|
|
||||||
shelljs "^0.7.4"
|
|
||||||
|
|
||||||
typings-test@^1.0.3:
|
|
||||||
version "1.0.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/typings-test/-/typings-test-1.0.3.tgz#fbab895eb3f0c44842e73db059f65946b971e369"
|
|
||||||
dependencies:
|
|
||||||
"@types/mocha" "^2.2.31"
|
|
||||||
typings-global "*"
|
|
||||||
|
|
||||||
wrappy@1:
|
|
||||||
version "1.0.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
|
|
Reference in New Issue
Block a user