Compare commits
43 Commits
Author | SHA1 | Date | |
---|---|---|---|
d13dfc9e76 | |||
942f6b37cf | |||
98ca73d0c7 | |||
ffedc7f601 | |||
8344fdf7b1 | |||
543dc98961 | |||
9c60105685 | |||
bdccf2c3a1 | |||
34d6df0923 | |||
3d3b07b7cb | |||
00004f70d6 | |||
2d263244c7 | |||
8cb1405d99 | |||
d357d6e52d | |||
c124f90a91 | |||
4bcf9f941e | |||
afb204325b | |||
cefbb6eecd | |||
c6a1a45812 | |||
00a892ee82 | |||
0eb6d13be9 | |||
c34f9611f9 | |||
820360a220 | |||
3893985bb2 | |||
33e19c54d9 | |||
074996433e | |||
6a803f1db9 | |||
927262d6d4 | |||
df39887de9 | |||
2b52b76ac6 | |||
136a06ff68 | |||
44bb4fa9ae | |||
93d5fc3070 | |||
08cd48b7bc | |||
bb17908ef5 | |||
3b8e31c8b0 | |||
a990c5ca32 | |||
2d4c480c1b | |||
05cd515824 | |||
bd4de36143 | |||
6a1fb1ec50 | |||
930f351626 | |||
9f6ab54a05 |
35
.gitlab-ci.yml
Normal file
35
.gitlab-ci.yml
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
image: hosttoday/ht-docker-node:npmts
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- test
|
||||||
|
- release
|
||||||
|
|
||||||
|
testLEGACY:
|
||||||
|
stage: test
|
||||||
|
script:
|
||||||
|
- npmci test legacy
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
|
||||||
|
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
|
12
.travis.yml
12
.travis.yml
@ -1,12 +0,0 @@
|
|||||||
language: node_js
|
|
||||||
node_js:
|
|
||||||
- '4.3.0'
|
|
||||||
- 'stable'
|
|
||||||
deploy:
|
|
||||||
provider: npm
|
|
||||||
email: npm@lossless.digital
|
|
||||||
api_key:
|
|
||||||
secure: oKx1gdYYBnaoUcpxn3WM4SdZdInIYaa3ZgbXLSh88K+PjbcSw3NNbYEnAtWFV1eAQQchDjOHId4D1Ne68DtJb5umahvhYoejtZzawjPaa6Uyi46VPk31wXYzZJyadiyefuwOhLLMM4i3yzYwEC2BeTpbU8Tvaj6B42DoySKNGUnSF9+K2wsFNp13mRje6PLe+fjo+9H4CEKLwf74alwvAWd/PLzv47KKdCZ4/9zX7TxevrIBNie+n6VxjqXm/dTv9k7J3dCunojehBr9X9sn1sd8mR+FexjcgfCA2dz8ViP8qZCslzZixGVuasmjpQH9OabrlOfQ6e+Hs4puv+U7s53SVa9nWntiYHloT29UKCPG6ofuDFq5Nd+1PCNvPfrh99F87IKTOw9DQ9Lx7Q//To4LrbnsC85/uHgkWHhbr/ZGax7wuX9og1rem1MSjYr7gQ1sx9edtDSQe3Yjhi22xDREL5/uCbnThmrd1P44CtAU7UG4TQvnHADFqi4Oogf/VBQvsC+aUJPSfZuoxX31yCYuNToH65j1Vblj9tYuPdHSriPj2OdxbuWh68lpgsh7K64Imb++3oKjh3fKZEzeJsByI+QytyUwO/Qu1c6whlkyv8yMyoaD0WARufU+zcG4P7j4rFlAO/CoezSd6l5HBUiXJNe7XniIi6KZjA1zkZc=
|
|
||||||
on:
|
|
||||||
tags: true
|
|
||||||
repo: pushrocks/smartstring
|
|
38
README.md
38
README.md
@ -1,2 +1,38 @@
|
|||||||
# smartstring
|
# smartstring
|
||||||
handle strings in smart ways.
|
handle strings in smart ways. TypeScript ready.
|
||||||
|
|
||||||
|
## Status
|
||||||
|
[](https://travis-ci.org/pushrocks/smartstring)
|
||||||
|
[](https://david-dm.org/pushrocks/smartstring)
|
||||||
|
[](https://www.bithound.io/github/pushrocks/smartstring/master/dependencies/npm)
|
||||||
|
[](https://www.bithound.io/github/pushrocks/smartstring)
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
Use TypeScript for intellisense.
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import * as smartstring from "smartstring";
|
||||||
|
|
||||||
|
// 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.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"
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## About the authors:
|
||||||
|
[](https://lossless.com/)
|
||||||
|
|
||||||
|
[](https://paypal.me/lossless)
|
||||||
|
18
dist/index.d.ts
vendored
18
dist/index.d.ts
vendored
@ -1,10 +1,8 @@
|
|||||||
/// <reference path="typings/main.d.ts" />
|
import * as SmartstringDocker from "./smartstring.docker";
|
||||||
import SmartstringGit = require("./smartstring.git");
|
import * as SmartstringTypescript from "./smartstring.typescript";
|
||||||
import SmartstringDocker = require("./smartstring.docker");
|
import * as SmartstringIndent from "./smartstring.indent";
|
||||||
import SmartstringTypescript = require("./smartstring.typescript");
|
export { Domain } from "./smartstring.domain";
|
||||||
declare let smartstring: {
|
export { GitRepo } from "./smartstring.git";
|
||||||
git: (stringArg: string, tokenArg?: string) => SmartstringGit.gitRepo;
|
export declare let docker: typeof SmartstringDocker;
|
||||||
docker: typeof SmartstringDocker;
|
export declare let typescript: typeof SmartstringTypescript;
|
||||||
typescript: typeof SmartstringTypescript;
|
export declare let indent: typeof SmartstringIndent;
|
||||||
};
|
|
||||||
export = smartstring;
|
|
||||||
|
23
dist/index.js
vendored
23
dist/index.js
vendored
@ -1,13 +1,12 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
/// <reference path="./typings/main.d.ts" />
|
const SmartstringDocker = require("./smartstring.docker");
|
||||||
var SmartstringGit = require("./smartstring.git");
|
const SmartstringTypescript = require("./smartstring.typescript");
|
||||||
var SmartstringDocker = require("./smartstring.docker");
|
const SmartstringIndent = require("./smartstring.indent");
|
||||||
var SmartstringTypescript = require("./smartstring.typescript");
|
var smartstring_domain_1 = require("./smartstring.domain");
|
||||||
var smartstring = {
|
exports.Domain = smartstring_domain_1.Domain;
|
||||||
git: SmartstringGit.git,
|
var smartstring_git_1 = require("./smartstring.git");
|
||||||
docker: SmartstringDocker,
|
exports.GitRepo = smartstring_git_1.GitRepo;
|
||||||
typescript: SmartstringTypescript
|
exports.docker = SmartstringDocker;
|
||||||
};
|
exports.typescript = SmartstringTypescript;
|
||||||
module.exports = smartstring;
|
exports.indent = SmartstringIndent;
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQ0EsTUFBWSxpQkFBaUIsV0FBTSxzQkFBc0IsQ0FBQyxDQUFBO0FBQzFELE1BQVkscUJBQXFCLFdBQU0sMEJBQTBCLENBQUMsQ0FBQTtBQUNsRSxNQUFZLGlCQUFpQixXQUFNLHNCQUFzQixDQUFDLENBQUE7QUFFMUQsbUNBQXFCLHNCQUFzQixDQUFDO0FBQXB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naXQgOiBTbWFydHN0cmluZ0dpdC5naXQsXG4gICAgZG9ja2VyOiBTbWFydHN0cmluZ0RvY2tlcixcbiAgICB0eXBlc2NyaXB0OiBTbWFydHN0cmluZ1R5cGVzY3JpcHRcbn07XG5cbmV4cG9ydCA9IHNtYXJ0c3RyaW5nOyJdfQ==
|
|
1
dist/smartstring.docker.d.ts
vendored
1
dist/smartstring.docker.d.ts
vendored
@ -1,4 +1,3 @@
|
|||||||
/// <reference path="typings/main.d.ts" />
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
|
13
dist/smartstring.docker.js
vendored
13
dist/smartstring.docker.js
vendored
@ -5,14 +5,15 @@
|
|||||||
* @returns {}
|
* @returns {}
|
||||||
*/
|
*/
|
||||||
exports.makeEnvObject = function (envArrayArg) {
|
exports.makeEnvObject = function (envArrayArg) {
|
||||||
var returnObject = {};
|
let returnObject = {};
|
||||||
var regexString = /(.*)=(.*)/;
|
let regexString = /(.*)=(.*)/;
|
||||||
for (var envKey in envArrayArg) {
|
if (typeof envArrayArg !== "undefined") {
|
||||||
var regexMatches = regexString.exec(envArrayArg[envKey]);
|
for (let envKey in envArrayArg) {
|
||||||
|
let regexMatches = regexString.exec(envArrayArg[envKey]);
|
||||||
returnObject[regexMatches[1]] = regexMatches[2];
|
returnObject[regexMatches[1]] = regexMatches[2];
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
}
|
||||||
return returnObject;
|
return returnObject;
|
||||||
};
|
};
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzdHJpbmcuZG9ja2VyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRzdHJpbmcuZG9ja2VyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFFQTs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FBQyxDQUFDLEdBQUcsWUFBWSxDQUFDLENBQUMsQ0FBQyxDQUFDO0lBQ3BELENBQUM7SUFBQSxDQUFDO0lBQ0YsTUFBTSxDQUFDLFlBQVksQ0FBQztBQUN4QixDQUFDLENBQUMiLCJmaWxlIjoic21hcnRzdHJpbmcuZG9ja2VyLmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4vdHlwaW5ncy9tYWluLmQudHNcIiAvPlxuaW1wb3J0IHBsdWdpbnMgPSByZXF1aXJlKFwiLi9zbWFydHN0cmluZy5wbHVnaW5zXCIpO1xuXG4vKipcbiAqIGNvbnZlcnRzIGFuIGVycmF5IG9mIGVudiBzdHJpbmdzIGZyb20gZG9ja2VyIHJlbW90ZSBhcGkgdG8gYW4gdXNhYmxlIG9iamVjdC5cbiAqIEBwYXJhbSBlbnZBcnJheUFyZ1xuICogQHJldHVybnMge31cbiAqL1xuZXhwb3J0IGxldCBtYWtlRW52T2JqZWN0ID0gZnVuY3Rpb24oZW52QXJyYXlBcmc6c3RyaW5nW10pe1xuICAgIGxldCByZXR1cm5PYmplY3QgPSB7fTtcbiAgICBsZXQgcmVnZXhTdHJpbmcgPSAvKC4qKT0oLiopLztcbiAgICBmb3IobGV0IGVudktleSBpbiBlbnZBcnJheUFyZyl7XG4gICAgICAgIGxldCByZWdleE1hdGNoZXMgPSByZWdleFN0cmluZy5leGVjKGVudkFycmF5QXJnW2VudktleV0pO1xuICAgICAgICByZXR1cm5PYmplY3RbcmVnZXhNYXRjaGVzWzFdXSA9IHJlZ2V4TWF0Y2hlc1syXTtcbiAgICB9O1xuICAgIHJldHVybiByZXR1cm5PYmplY3Q7XG59OyJdfQ==
|
|
14
dist/smartstring.domain.d.ts
vendored
Normal file
14
dist/smartstring.domain.d.ts
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
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
Normal file
52
dist/smartstring.domain.js
vendored
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
"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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzdHJpbmcuZG9tYWluLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRzdHJpbmcuZG9tYWluLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFFQTtJQWFJLFlBQVksZUFBc0I7UUFDOUIsSUFBSSxZQUFZLEdBQUcsV0FBVyxDQUFDLGVBQWUsQ0FBQyxDQUFDO1FBQ2hELElBQUksQ0FBQyxRQUFRLEdBQUcsRUFBRSxDQUFDO1FBQ25CLEdBQUcsQ0FBQSxDQUFDLElBQUksQ0FBQyxHQUFHLENBQUMsRUFBRSxDQUFDLElBQUksQ0FBQyxFQUFFLENBQUMsRUFBRSxFQUFDLENBQUM7WUFDeEIsRUFBRSxDQUFBLENBQUMsWUFBWSxDQUFDLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7Z0JBQ3JCLElBQUksVUFBVSxHQUFHLFlBQVksQ0FBQyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUE7Z0JBQ3BDLElBQUksQ0FBQyxPQUFPLEdBQUcsQ0FBQyxDQUFDLFFBQVEsRUFBRSxDQUFDLEdBQUcsVUFBVSxDQUFDO2dCQUMxQyxFQUFFLENBQUMsQ0FBQ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UFBRSxDQUFDLENBQUMsMkVBQTJFO0lBQ25HLFlBQVksQ0FBQyxHQUFHLEVBQUUsQ0FBQyxDQUFDLG1HQUFtRztJQUN2SCxJQUFJLG9CQUFvQixHQUFHLFlBQVksQ0FBQyxNQUFNLENBQUMsVUFBUyxTQUFnQjtRQUNwRSxNQUFNLENBQUEsQ0FBQyxTQUFTLElBQUksRUFBRSxDQUFDLENBQUM7SUFDNUIsQ0FBQyxDQUFDLENBQUM7SUFDSCxNQUFNLENBQUMsb0JBQW9CLENBQUM7QUFDaEMsQ0FBQyxDQUFDO0FBRUYsSUFBSSxhQUFhLEdBQUcsVUFBUyxTQUFnQjtJQUN6QyxJQUFJLFdBQVcsR0FBRyxzQkFBc0IsQ0FBQztJQUN6QyxJQUFJLFlBQVksR0FBRyxXQUFXLENBQUMsSUFBSSxDQUFDLFNBQVMsQ0FBQyxDQUFDO0lBQy9DLEVBQUUsQ0FBQSxDQUFDLFlBQVksQ0FBQyxDQUFBLENBQUM7UUFDYixNQUFNLENBQUMsWUFBWSxDQUFDLENBQUMsQ0FBQyxDQUFDO0lBQzNCLENBQUM7SUFBQyxJQUFJLENBQUMsQ0FBQztRQUNKLE1BQU0sQ0FBQyxTQUFTLENBQUM7SUFDckIsQ0FBQztBQUNMLENBQUMsQ0FBQSJ9
|
4
dist/smartstring.git.d.ts
vendored
4
dist/smartstring.git.d.ts
vendored
@ -1,5 +1,4 @@
|
|||||||
/// <reference path="typings/main.d.ts" />
|
export declare class GitRepo {
|
||||||
export declare class gitRepo {
|
|
||||||
host: string;
|
host: string;
|
||||||
user: string;
|
user: string;
|
||||||
repo: string;
|
repo: string;
|
||||||
@ -8,4 +7,3 @@ export declare class gitRepo {
|
|||||||
httpsUrl: string;
|
httpsUrl: string;
|
||||||
constructor(stringArg: string, tokenArg?: string);
|
constructor(stringArg: string, tokenArg?: string);
|
||||||
}
|
}
|
||||||
export declare let git: (stringArg: string, tokenArg?: string) => gitRepo;
|
|
||||||
|
35
dist/smartstring.git.js
vendored
35
dist/smartstring.git.js
vendored
File diff suppressed because one or more lines are too long
3
dist/smartstring.indent.d.ts
vendored
Normal file
3
dist/smartstring.indent.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
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;
|
63
dist/smartstring.indent.js
vendored
Normal file
63
dist/smartstring.indent.js
vendored
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
"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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzdHJpbmcuaW5kZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRzdHJpbmcuaW5kZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFFQSxJQUFJLFdBQVcsR0FBRyxDQUFDLFNBQWdCO0lBQy9CLElBQUksV0FBVyxHQUFHLFNBQVMsQ0FBQyxLQUFLLENBQUMsSUFBSSxDQUFDLENBQUM7SUFDeEMsTUFBTSxDQUFDLGdCQUFnQixDQUFDLFdBQVcsQ0FBQyxDQUFDO0FBQ3pDLENBQUMsQ0FBQztBQUVGLElBQUksVUFBVSxHQUFHLENBQUMsY0FBdUI7SUFDckMsSUFBSSxZQUFZLEdBQVUsRUFBRSxDQUFDO0lBQzdCLEdBQUcsQ0FBQSxDQUFDLElBQUksSUFBSSxJQUFJLGNBQWMsQ0FBQyxDQUFBLENBQUM7UUFDN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QixDQUFDLElBQUksQ0FBQyxVQUFVLENBQUMsTUFBTSxDQUFDLG1CQUFtQixDQUFDLENBQUMsQ0FBQztJQUN4RSxDQUFDO0lBQUEsQ0FBQztJQUNGLFlBQVksR0FBRyxVQUFVLENBQUMsc0JBQXNCLENBQUMsQ0FBQztJQUNsRCxNQUFNLENBQUMsWUFBWSxDQUFDO0FBQ3hCLENBQUMsQ0FBQSJ9
|
7
dist/smartstring.plugins.d.ts
vendored
7
dist/smartstring.plugins.d.ts
vendored
@ -1,5 +1,2 @@
|
|||||||
/// <reference path="typings/main.d.ts" />
|
import "typings-global";
|
||||||
declare let plugins: {
|
export import beautylog = require("beautylog");
|
||||||
beautylog: any;
|
|
||||||
};
|
|
||||||
export = plugins;
|
|
||||||
|
10
dist/smartstring.plugins.js
vendored
10
dist/smartstring.plugins.js
vendored
@ -1,8 +1,4 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
/// <reference path="./typings/main.d.ts" />
|
require("typings-global");
|
||||||
var plugins = {
|
exports.beautylog = require("beautylog");
|
||||||
beautylog: require("beautylog")
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzdHJpbmcucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0c3RyaW5nLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQ1AsQ0FBQyxDQURzQjtBQUNULGlCQUFTLFdBQVcsV0FBVyxDQUFDLENBQUMifQ==
|
||||||
};
|
|
||||||
module.exports = plugins;
|
|
||||||
|
|
||||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3RyaW5nLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDRDQUE0QztBQUM1QyxJQUFJLE9BQU8sR0FBRztJQUNWLFNBQVMsRUFBRSxPQUFPLENBQUMsV0FBVyxDQUFDO0NBQ2xDLENBQUM7QUFFRixpQkFBUyxPQUFPLENBQUMiLCJmaWxlIjoic21hcnRzdHJpbmcucGx1Z2lucy5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8vLyA8cmVmZXJlbmNlIHBhdGg9XCIuL3R5cGluZ3MvbWFpbi5kLnRzXCIgLz5cbmxldCBwbHVnaW5zID0ge1xuICAgIGJlYXV0eWxvZzogcmVxdWlyZShcImJlYXV0eWxvZ1wiKVxufTtcblxuZXhwb3J0ID0gcGx1Z2luczsiXX0=
|
|
3
dist/smartstring.typescript.js
vendored
3
dist/smartstring.typescript.js
vendored
@ -1,4 +1,3 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
exports.regexReferencePath = /\/\/\/\s*<reference\s+path\s*=\s*["|'].*["|']\s*\/>\s*[\\n]?/;
|
exports.regexReferencePath = /\/\/\/\s*<reference\s+path\s*=\s*["|'].*["|']\s*\/>\s*[\\n]?/;
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzdHJpbmcudHlwZXNjcmlwdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0c3RyaW5nLnR5cGVzY3JpcHQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUVXLDBCQUFrQixHQUFHLDhEQUE4RCxDQUFBIn0=
|
||||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3RyaW5nLnR5cGVzY3JpcHQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUVXLDBCQUFrQixHQUFHLDhEQUE4RCxDQUFBIiwiZmlsZSI6InNtYXJ0c3RyaW5nLnR5cGVzY3JpcHQuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgcGx1Z2lucyA9IHJlcXVpcmUoXCIuL3NtYXJ0c3RyaW5nLnBsdWdpbnNcIik7XG5cbmV4cG9ydCBsZXQgcmVnZXhSZWZlcmVuY2VQYXRoID0gL1xcL1xcL1xcL1xccyo8cmVmZXJlbmNlXFxzK3BhdGhcXHMqPVxccypbXCJ8J10uKltcInwnXVxccypcXC8+XFxzKltcXFxcbl0/LyJdfQ==
|
|
3
dist/typings/browser.d.ts
vendored
3
dist/typings/browser.d.ts
vendored
@ -1,3 +0,0 @@
|
|||||||
/// <reference path="browser/ambient/colors/index.d.ts" />
|
|
||||||
/// <reference path="browser/ambient/mocha/index.d.ts" />
|
|
||||||
/// <reference path="browser/ambient/node/index.d.ts" />
|
|
126
dist/typings/browser/ambient/colors/index.d.ts
vendored
126
dist/typings/browser/ambient/colors/index.d.ts
vendored
@ -1,126 +0,0 @@
|
|||||||
// Generated by typings
|
|
||||||
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/master/colors/colors.d.ts
|
|
||||||
// Type definitions for Colors.js 0.6.0-1
|
|
||||||
// Project: https://github.com/Marak/colors.js
|
|
||||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
|
||||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
||||||
|
|
||||||
declare module "colors" {
|
|
||||||
interface Color {
|
|
||||||
(text: string): string;
|
|
||||||
|
|
||||||
black: Color;
|
|
||||||
red: Color;
|
|
||||||
green: Color;
|
|
||||||
yellow: Color;
|
|
||||||
blue: Color;
|
|
||||||
magenta: Color;
|
|
||||||
cyan: Color;
|
|
||||||
white: Color;
|
|
||||||
gray: Color;
|
|
||||||
grey: Color;
|
|
||||||
|
|
||||||
bgBlack: Color;
|
|
||||||
bgRed: Color;
|
|
||||||
bgGreen: Color;
|
|
||||||
bgYellow: Color;
|
|
||||||
bgBlue: Color;
|
|
||||||
bgMagenta: Color;
|
|
||||||
bgCyan: Color;
|
|
||||||
bgWhite: Color;
|
|
||||||
|
|
||||||
reset: Color;
|
|
||||||
bold: Color;
|
|
||||||
dim: Color;
|
|
||||||
italic: Color;
|
|
||||||
underline: Color;
|
|
||||||
inverse: Color;
|
|
||||||
hidden: Color;
|
|
||||||
strikethrough: Color;
|
|
||||||
|
|
||||||
rainbow: Color;
|
|
||||||
zebra: Color;
|
|
||||||
america: Color;
|
|
||||||
trap: Color;
|
|
||||||
random: Color;
|
|
||||||
zalgo: Color;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace e {
|
|
||||||
export function setTheme(theme:any): void;
|
|
||||||
|
|
||||||
export var black: Color;
|
|
||||||
export var red: Color;
|
|
||||||
export var green: Color;
|
|
||||||
export var yellow: Color;
|
|
||||||
export var blue: Color;
|
|
||||||
export var magenta: Color;
|
|
||||||
export var cyan: Color;
|
|
||||||
export var white: Color;
|
|
||||||
export var gray: Color;
|
|
||||||
export var grey: Color;
|
|
||||||
|
|
||||||
export var bgBlack: Color;
|
|
||||||
export var bgRed: Color;
|
|
||||||
export var bgGreen: Color;
|
|
||||||
export var bgYellow: Color;
|
|
||||||
export var bgBlue: Color;
|
|
||||||
export var bgMagenta: Color;
|
|
||||||
export var bgCyan: Color;
|
|
||||||
export var bgWhite: Color;
|
|
||||||
|
|
||||||
export var reset: Color;
|
|
||||||
export var bold: Color;
|
|
||||||
export var dim: Color;
|
|
||||||
export var italic: Color;
|
|
||||||
export var underline: Color;
|
|
||||||
export var inverse: Color;
|
|
||||||
export var hidden: Color;
|
|
||||||
export var strikethrough: Color;
|
|
||||||
|
|
||||||
export var rainbow: Color;
|
|
||||||
export var zebra: Color;
|
|
||||||
export var america: Color;
|
|
||||||
export var trap: Color;
|
|
||||||
export var random: Color;
|
|
||||||
}
|
|
||||||
|
|
||||||
export = e;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface String {
|
|
||||||
black: string;
|
|
||||||
red: string;
|
|
||||||
green: string;
|
|
||||||
yellow: string;
|
|
||||||
blue: string;
|
|
||||||
magenta: string;
|
|
||||||
cyan: string;
|
|
||||||
white: string;
|
|
||||||
gray: string;
|
|
||||||
grey: string;
|
|
||||||
|
|
||||||
bgBlack: string;
|
|
||||||
bgRed: string;
|
|
||||||
bgGreen: string;
|
|
||||||
bgYellow: string;
|
|
||||||
bgBlue: string;
|
|
||||||
bgMagenta: string;
|
|
||||||
bgCyan: string;
|
|
||||||
bgWhite: string;
|
|
||||||
|
|
||||||
reset: string;
|
|
||||||
bold: string;
|
|
||||||
dim: string;
|
|
||||||
italic: string;
|
|
||||||
underline: string;
|
|
||||||
inverse: string;
|
|
||||||
hidden: string;
|
|
||||||
strikethrough: string;
|
|
||||||
|
|
||||||
rainbow: string;
|
|
||||||
zebra: string;
|
|
||||||
america: string;
|
|
||||||
trap: string;
|
|
||||||
random: string;
|
|
||||||
}
|
|
40
dist/typings/browser/ambient/mocha/index.d.ts
vendored
40
dist/typings/browser/ambient/mocha/index.d.ts
vendored
@ -1,40 +0,0 @@
|
|||||||
// Generated by typings
|
|
||||||
// Source: https://raw.githubusercontent.com/Bartvds/tsd-deftools/master/typings/DefinitelyTyped/mocha/mocha.d.ts
|
|
||||||
// Type definitions for mocha 1.9.0
|
|
||||||
// Project: http://visionmedia.github.io/mocha/
|
|
||||||
// Definitions by: Kazi Manzur Rashid <https://github.com/kazimanzurrashid/>
|
|
||||||
// Definitions by: Kazi Manzur Rashid <https://github.com/kazimanzurrashid/>
|
|
||||||
// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
|
|
||||||
declare var describe : {
|
|
||||||
(description: string, spec: () => void): void;
|
|
||||||
only(description: string, spec: () => void): void;
|
|
||||||
skip(description: string, spec: () => void): void;
|
|
||||||
timeout(ms: number);
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var it: {
|
|
||||||
(expectation: string, assertion?: () => void): void;
|
|
||||||
(expectation: string, assertion?: (done: () => void) => void): void;
|
|
||||||
only(expectation: string, assertion?: () => void): void;
|
|
||||||
only(expectation: string, assertion?: (done: () => void) => void): void;
|
|
||||||
skip(expectation: string, assertion?: () => void): void;
|
|
||||||
skip(expectation: string, assertion?: (done: () => void) => void): void;
|
|
||||||
timeout(ms: number);
|
|
||||||
};
|
|
||||||
|
|
||||||
declare function before(action: () => void): void;
|
|
||||||
|
|
||||||
declare function before(action: (done: () => void) => void): void;
|
|
||||||
|
|
||||||
declare function aftet(action: () => void): void;
|
|
||||||
|
|
||||||
declare function after(action: (done: () => void) => void): void;
|
|
||||||
|
|
||||||
declare function beforeEach(action: () => void): void;
|
|
||||||
|
|
||||||
declare function beforeEach(action: (done: () => void) => void): void;
|
|
||||||
|
|
||||||
declare function afterEach(action: () => void): void;
|
|
||||||
|
|
||||||
declare function afterEach(action: (done: () => void) => void): void;
|
|
2346
dist/typings/browser/ambient/node/index.d.ts
vendored
2346
dist/typings/browser/ambient/node/index.d.ts
vendored
File diff suppressed because it is too large
Load Diff
3
dist/typings/main.d.ts
vendored
3
dist/typings/main.d.ts
vendored
@ -1,3 +0,0 @@
|
|||||||
/// <reference path="main/ambient/colors/index.d.ts" />
|
|
||||||
/// <reference path="main/ambient/mocha/index.d.ts" />
|
|
||||||
/// <reference path="main/ambient/node/index.d.ts" />
|
|
126
dist/typings/main/ambient/colors/index.d.ts
vendored
126
dist/typings/main/ambient/colors/index.d.ts
vendored
@ -1,126 +0,0 @@
|
|||||||
// Generated by typings
|
|
||||||
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/master/colors/colors.d.ts
|
|
||||||
// Type definitions for Colors.js 0.6.0-1
|
|
||||||
// Project: https://github.com/Marak/colors.js
|
|
||||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
|
||||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
||||||
|
|
||||||
declare module "colors" {
|
|
||||||
interface Color {
|
|
||||||
(text: string): string;
|
|
||||||
|
|
||||||
black: Color;
|
|
||||||
red: Color;
|
|
||||||
green: Color;
|
|
||||||
yellow: Color;
|
|
||||||
blue: Color;
|
|
||||||
magenta: Color;
|
|
||||||
cyan: Color;
|
|
||||||
white: Color;
|
|
||||||
gray: Color;
|
|
||||||
grey: Color;
|
|
||||||
|
|
||||||
bgBlack: Color;
|
|
||||||
bgRed: Color;
|
|
||||||
bgGreen: Color;
|
|
||||||
bgYellow: Color;
|
|
||||||
bgBlue: Color;
|
|
||||||
bgMagenta: Color;
|
|
||||||
bgCyan: Color;
|
|
||||||
bgWhite: Color;
|
|
||||||
|
|
||||||
reset: Color;
|
|
||||||
bold: Color;
|
|
||||||
dim: Color;
|
|
||||||
italic: Color;
|
|
||||||
underline: Color;
|
|
||||||
inverse: Color;
|
|
||||||
hidden: Color;
|
|
||||||
strikethrough: Color;
|
|
||||||
|
|
||||||
rainbow: Color;
|
|
||||||
zebra: Color;
|
|
||||||
america: Color;
|
|
||||||
trap: Color;
|
|
||||||
random: Color;
|
|
||||||
zalgo: Color;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace e {
|
|
||||||
export function setTheme(theme:any): void;
|
|
||||||
|
|
||||||
export var black: Color;
|
|
||||||
export var red: Color;
|
|
||||||
export var green: Color;
|
|
||||||
export var yellow: Color;
|
|
||||||
export var blue: Color;
|
|
||||||
export var magenta: Color;
|
|
||||||
export var cyan: Color;
|
|
||||||
export var white: Color;
|
|
||||||
export var gray: Color;
|
|
||||||
export var grey: Color;
|
|
||||||
|
|
||||||
export var bgBlack: Color;
|
|
||||||
export var bgRed: Color;
|
|
||||||
export var bgGreen: Color;
|
|
||||||
export var bgYellow: Color;
|
|
||||||
export var bgBlue: Color;
|
|
||||||
export var bgMagenta: Color;
|
|
||||||
export var bgCyan: Color;
|
|
||||||
export var bgWhite: Color;
|
|
||||||
|
|
||||||
export var reset: Color;
|
|
||||||
export var bold: Color;
|
|
||||||
export var dim: Color;
|
|
||||||
export var italic: Color;
|
|
||||||
export var underline: Color;
|
|
||||||
export var inverse: Color;
|
|
||||||
export var hidden: Color;
|
|
||||||
export var strikethrough: Color;
|
|
||||||
|
|
||||||
export var rainbow: Color;
|
|
||||||
export var zebra: Color;
|
|
||||||
export var america: Color;
|
|
||||||
export var trap: Color;
|
|
||||||
export var random: Color;
|
|
||||||
}
|
|
||||||
|
|
||||||
export = e;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface String {
|
|
||||||
black: string;
|
|
||||||
red: string;
|
|
||||||
green: string;
|
|
||||||
yellow: string;
|
|
||||||
blue: string;
|
|
||||||
magenta: string;
|
|
||||||
cyan: string;
|
|
||||||
white: string;
|
|
||||||
gray: string;
|
|
||||||
grey: string;
|
|
||||||
|
|
||||||
bgBlack: string;
|
|
||||||
bgRed: string;
|
|
||||||
bgGreen: string;
|
|
||||||
bgYellow: string;
|
|
||||||
bgBlue: string;
|
|
||||||
bgMagenta: string;
|
|
||||||
bgCyan: string;
|
|
||||||
bgWhite: string;
|
|
||||||
|
|
||||||
reset: string;
|
|
||||||
bold: string;
|
|
||||||
dim: string;
|
|
||||||
italic: string;
|
|
||||||
underline: string;
|
|
||||||
inverse: string;
|
|
||||||
hidden: string;
|
|
||||||
strikethrough: string;
|
|
||||||
|
|
||||||
rainbow: string;
|
|
||||||
zebra: string;
|
|
||||||
america: string;
|
|
||||||
trap: string;
|
|
||||||
random: string;
|
|
||||||
}
|
|
40
dist/typings/main/ambient/mocha/index.d.ts
vendored
40
dist/typings/main/ambient/mocha/index.d.ts
vendored
@ -1,40 +0,0 @@
|
|||||||
// Generated by typings
|
|
||||||
// Source: https://raw.githubusercontent.com/Bartvds/tsd-deftools/master/typings/DefinitelyTyped/mocha/mocha.d.ts
|
|
||||||
// Type definitions for mocha 1.9.0
|
|
||||||
// Project: http://visionmedia.github.io/mocha/
|
|
||||||
// Definitions by: Kazi Manzur Rashid <https://github.com/kazimanzurrashid/>
|
|
||||||
// Definitions by: Kazi Manzur Rashid <https://github.com/kazimanzurrashid/>
|
|
||||||
// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
|
|
||||||
declare var describe : {
|
|
||||||
(description: string, spec: () => void): void;
|
|
||||||
only(description: string, spec: () => void): void;
|
|
||||||
skip(description: string, spec: () => void): void;
|
|
||||||
timeout(ms: number);
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var it: {
|
|
||||||
(expectation: string, assertion?: () => void): void;
|
|
||||||
(expectation: string, assertion?: (done: () => void) => void): void;
|
|
||||||
only(expectation: string, assertion?: () => void): void;
|
|
||||||
only(expectation: string, assertion?: (done: () => void) => void): void;
|
|
||||||
skip(expectation: string, assertion?: () => void): void;
|
|
||||||
skip(expectation: string, assertion?: (done: () => void) => void): void;
|
|
||||||
timeout(ms: number);
|
|
||||||
};
|
|
||||||
|
|
||||||
declare function before(action: () => void): void;
|
|
||||||
|
|
||||||
declare function before(action: (done: () => void) => void): void;
|
|
||||||
|
|
||||||
declare function aftet(action: () => void): void;
|
|
||||||
|
|
||||||
declare function after(action: (done: () => void) => void): void;
|
|
||||||
|
|
||||||
declare function beforeEach(action: () => void): void;
|
|
||||||
|
|
||||||
declare function beforeEach(action: (done: () => void) => void): void;
|
|
||||||
|
|
||||||
declare function afterEach(action: () => void): void;
|
|
||||||
|
|
||||||
declare function afterEach(action: (done: () => void) => void): void;
|
|
2346
dist/typings/main/ambient/node/index.d.ts
vendored
2346
dist/typings/main/ambient/node/index.d.ts
vendored
File diff suppressed because it is too large
Load Diff
19
package.json
19
package.json
@ -1,14 +1,15 @@
|
|||||||
{
|
{
|
||||||
"name": "smartstring",
|
"name": "smartstring",
|
||||||
"version": "1.0.2",
|
"version": "2.0.16",
|
||||||
"description": "bundles a bunch of (regex) matching and altering methods.",
|
"description": "handle strings in smart ways. TypeScript ready.",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
"typings": "dist/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(npmts)"
|
"test": "(npmts)"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/pushrocks/smartstring.git"
|
"url": "git+https://gitlab.com/pushrocks/smartstring.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"regex",
|
"regex",
|
||||||
@ -17,14 +18,16 @@
|
|||||||
"author": "Lossless GmbH",
|
"author": "Lossless GmbH",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/pushrocks/smartstring/issues"
|
"url": "https://gitlab.com/pushrocks/smartstring/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/pushrocks/smartstring#readme",
|
"homepage": "https://gitlab.com/pushrocks/smartstring#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"npmts": "^5.0.4",
|
"npmts-g": "^5.2.8",
|
||||||
"should": "^8.3.1"
|
"should": "^10.0.0",
|
||||||
|
"typings-test": "^1.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"beautylog": "^4.1.2"
|
"beautylog": "^5.0.20",
|
||||||
|
"typings-global": "^1.0.6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
4
test/test.d.ts
vendored
4
test/test.d.ts
vendored
@ -1,3 +1 @@
|
|||||||
/// <reference path="../ts/typings/main.d.ts" />
|
import "typings-test";
|
||||||
declare let smartstring: any;
|
|
||||||
declare let should: any;
|
|
||||||
|
74
test/test.js
74
test/test.js
File diff suppressed because one or more lines are too long
67
test/test.ts
67
test/test.ts
@ -1,10 +1,42 @@
|
|||||||
/// <reference path="../ts/typings/main.d.ts" />
|
import "typings-test"
|
||||||
let smartstring = require("../dist/index.js");
|
import * as smartstring from "../dist/index";
|
||||||
let should = require("should");
|
let should = require("should");
|
||||||
|
|
||||||
describe("smartstring",function(){
|
describe("smartstring",function(){
|
||||||
describe(".git()",function(){
|
describe(".Domain class",function(){
|
||||||
let testGit = smartstring.git("git+https://github.com/pushrocks/smartstring.git");
|
let testDomain:smartstring.Domain;
|
||||||
|
let testDomain2:smartstring.Domain;
|
||||||
|
it("should create a new Domain object",function(){
|
||||||
|
testDomain = new smartstring.Domain("https://level3D.level2D.level1D");
|
||||||
|
testDomain.should.be.instanceof(smartstring.Domain);
|
||||||
|
console.log(testDomain);
|
||||||
|
});
|
||||||
|
it("should have a .topLevel",function(){
|
||||||
|
testDomain.topLevel.should.equal("level1D");
|
||||||
|
});
|
||||||
|
it("should have a .level2",function(){
|
||||||
|
testDomain.level2.should.equal("level2D");
|
||||||
|
});
|
||||||
|
it("should have a .level3",function(){
|
||||||
|
testDomain.level3.should.equal("level3D");
|
||||||
|
});
|
||||||
|
it("should have the correct dns zone name",function(){
|
||||||
|
testDomain.zoneName.should.equal("level2D.level1D");
|
||||||
|
})
|
||||||
|
it ("should have the correct protocol",function(){
|
||||||
|
testDomain.protocol.should.equal("https");
|
||||||
|
})
|
||||||
|
it("testDomain2 should be a basic domain",function(){
|
||||||
|
testDomain2 = new smartstring.Domain("bleu.de");
|
||||||
|
console.log(testDomain2);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
describe(".Git class",function(){
|
||||||
|
let testGit:smartstring.GitRepo;
|
||||||
|
it("should create a new Git class GitRepo",function(){
|
||||||
|
testGit = new smartstring.GitRepo("git+https://github.com/pushrocks/smartstring.git");
|
||||||
|
testGit.should.be.instanceof(smartstring.GitRepo);
|
||||||
|
})
|
||||||
it("should return a .host",function(){
|
it("should return a .host",function(){
|
||||||
testGit.host
|
testGit.host
|
||||||
.should.equal("github.com");
|
.should.equal("github.com");
|
||||||
@ -30,12 +62,37 @@ describe("smartstring",function(){
|
|||||||
describe(".makeEnvObject",function(){
|
describe(".makeEnvObject",function(){
|
||||||
it("should create a Env Object",function(){
|
it("should create a Env Object",function(){
|
||||||
let envStringArray = ["VIRTUAL_HOST=sub.domain.tld","DEFAULT_HOST=some.domain.com"];
|
let envStringArray = ["VIRTUAL_HOST=sub.domain.tld","DEFAULT_HOST=some.domain.com"];
|
||||||
let envObject = smartstring.docker.makeEnvObject(envStringArray);
|
let envObject:any = smartstring.docker.makeEnvObject(envStringArray);
|
||||||
envObject.VIRTUAL_HOST.should.equal("sub.domain.tld");
|
envObject.VIRTUAL_HOST.should.equal("sub.domain.tld");
|
||||||
envObject.DEFAULT_HOST.should.equal("some.domain.com");
|
envObject.DEFAULT_HOST.should.equal("some.domain.com");
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
});
|
||||||
|
describe(".indent",function(){
|
||||||
|
let testString = `
|
||||||
|
base
|
||||||
|
should be indented
|
||||||
|
some more
|
||||||
|
|
||||||
|
base
|
||||||
|
indented
|
||||||
|
`;
|
||||||
|
describe(".normalize()",function(){
|
||||||
|
it("should normalize a string",function(){
|
||||||
|
testString = smartstring.indent.normalize(testString);
|
||||||
|
console.log(testString);
|
||||||
|
let zoneNameArg = "test1";
|
||||||
|
let destinationIpArg = "111";
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe(".indentWithPrefix",function(){
|
||||||
|
it("should indent",function(){
|
||||||
|
testString = smartstring.indent.indentWithPrefix(testString,">> ");
|
||||||
|
console.log(testString);
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
});
|
||||||
describe(".typescript",function(){
|
describe(".typescript",function(){
|
||||||
describe(".referenceRegex",function(){
|
describe(".referenceRegex",function(){
|
||||||
it("should match reference paths",function(){
|
it("should match reference paths",function(){
|
||||||
|
20
ts/index.ts
20
ts/index.ts
@ -1,12 +1,10 @@
|
|||||||
/// <reference path="./typings/main.d.ts" />
|
import * as plugins from "./smartstring.plugins";
|
||||||
import SmartstringGit = require("./smartstring.git");
|
import * as SmartstringDocker from "./smartstring.docker";
|
||||||
import SmartstringDocker = require("./smartstring.docker");
|
import * as SmartstringTypescript from "./smartstring.typescript";
|
||||||
import SmartstringTypescript = require("./smartstring.typescript");
|
import * as SmartstringIndent from "./smartstring.indent";
|
||||||
|
|
||||||
let smartstring = {
|
export {Domain} from "./smartstring.domain";
|
||||||
git : SmartstringGit.git,
|
export {GitRepo} from "./smartstring.git";
|
||||||
docker: SmartstringDocker,
|
export let docker = SmartstringDocker;
|
||||||
typescript: SmartstringTypescript
|
export let typescript = SmartstringTypescript;
|
||||||
};
|
export let indent = SmartstringIndent;
|
||||||
|
|
||||||
export = smartstring;
|
|
@ -1,5 +1,4 @@
|
|||||||
/// <reference path="./typings/main.d.ts" />
|
import * as plugins from "./smartstring.plugins";
|
||||||
import plugins = require("./smartstring.plugins");
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
@ -9,9 +8,11 @@ import plugins = require("./smartstring.plugins");
|
|||||||
export let makeEnvObject = function (envArrayArg: string[]) {
|
export let makeEnvObject = function (envArrayArg: string[]) {
|
||||||
let returnObject = {};
|
let returnObject = {};
|
||||||
let regexString = /(.*)=(.*)/;
|
let regexString = /(.*)=(.*)/;
|
||||||
|
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;
|
||||||
};
|
};
|
62
ts/smartstring.domain.ts
Normal file
62
ts/smartstring.domain.ts
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
import * as plugins from "./smartstring.plugins";
|
||||||
|
|
||||||
|
export class Domain {
|
||||||
|
fullName:string;
|
||||||
|
level1:string;
|
||||||
|
level2:string;
|
||||||
|
level3:string;
|
||||||
|
level4:string;
|
||||||
|
level5:string;
|
||||||
|
protocol:string;
|
||||||
|
zoneName:string;
|
||||||
|
//aliases
|
||||||
|
topLevel:string;
|
||||||
|
domainName;
|
||||||
|
subDomain;
|
||||||
|
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
|
||||||
|
this.topLevel = this.level1;
|
||||||
|
this.domainName = this.level2;
|
||||||
|
this.subDomain = this.level3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
let domainRegex = function(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}$/;
|
||||||
|
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:string){
|
||||||
|
return(stringArg != "");
|
||||||
|
});
|
||||||
|
return regexMatchesFiltered;
|
||||||
|
};
|
||||||
|
|
||||||
|
let protocolRegex = function(stringArg:string){
|
||||||
|
let regexString = /^([a-zA-Z0-9]*):\/\//;
|
||||||
|
let regexMatches = regexString.exec(stringArg);
|
||||||
|
if(regexMatches){
|
||||||
|
return regexMatches[1];
|
||||||
|
} else {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
}
|
@ -1,10 +1,9 @@
|
|||||||
/// <reference path="./typings/main.d.ts" />
|
import * as plugins from "./smartstring.plugins";
|
||||||
import plugins = require("./smartstring.plugins");
|
|
||||||
|
|
||||||
/* ---------------------------------------------- *
|
/* ---------------------------------------------- *
|
||||||
* ------------------ classes ------------------- *
|
* ------------------ classes ------------------- *
|
||||||
* ---------------------------------------------- */
|
* ---------------------------------------------- */
|
||||||
export class gitRepo {
|
export class GitRepo {
|
||||||
host:string;
|
host:string;
|
||||||
user:string;
|
user:string;
|
||||||
repo:string;
|
repo:string;
|
||||||
@ -26,7 +25,7 @@ export class gitRepo {
|
|||||||
* ------------------ helpers ------------------- *
|
* ------------------ helpers ------------------- *
|
||||||
* ---------------------------------------------- */
|
* ---------------------------------------------- */
|
||||||
let gitRegex = function(stringArg:string){
|
let gitRegex = function(stringArg:string){
|
||||||
let regexString = /(?:git\+|git\@|https\:\/\/|)(?:https\:\/\/|)([^\/|\:]*)(?:\/|:)([^\/]+)*(?:\/|:)([^\.]+)/;
|
let regexString = /([a-zA-Z0-9\-\.]*)(?:\/|\:)([a-zA-Z0-9\-]*)(?:\/)([a-zA-Z0-9\-]*)(?:\.git)/;
|
||||||
let regexMatches = regexString.exec(stringArg);
|
let regexMatches = regexString.exec(stringArg);
|
||||||
return regexMatches;
|
return regexMatches;
|
||||||
};
|
};
|
||||||
@ -51,11 +50,3 @@ let gitLink = function(hostArg:string, userArg:string, repoArg:string, tokenArg:
|
|||||||
}
|
}
|
||||||
return returnString;
|
return returnString;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ---------------------------------------------- *
|
|
||||||
* ------------------ exports ------------------- *
|
|
||||||
* ---------------------------------------------- */
|
|
||||||
export let git = function(stringArg:string,tokenArg?:string){
|
|
||||||
let localGitRepo = new gitRepo(stringArg,tokenArg);
|
|
||||||
return localGitRepo;
|
|
||||||
};
|
|
64
ts/smartstring.indent.ts
Normal file
64
ts/smartstring.indent.ts
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
import * as plugins from "./smartstring.plugins";
|
||||||
|
|
||||||
|
let splitString = (stringArg:string):string[] => {
|
||||||
|
let resultArray = stringArg.split("\n");
|
||||||
|
return cleanStringArray(resultArray);
|
||||||
|
};
|
||||||
|
|
||||||
|
let joinString = (stringArrayArg:string[]):string => {
|
||||||
|
let resultString:string = "";
|
||||||
|
for(let line of stringArrayArg){
|
||||||
|
resultString = resultString + line + "\n";
|
||||||
|
};
|
||||||
|
return resultString;
|
||||||
|
};
|
||||||
|
|
||||||
|
let 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
@ -1,6 +1,2 @@
|
|||||||
/// <reference path="./typings/main.d.ts" />
|
import "typings-global"
|
||||||
let plugins = {
|
export import beautylog = require("beautylog");
|
||||||
beautylog: require("beautylog")
|
|
||||||
};
|
|
||||||
|
|
||||||
export = plugins;
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
import plugins = require("./smartstring.plugins");
|
import * as plugins from "./smartstring.plugins";
|
||||||
|
|
||||||
export let regexReferencePath = /\/\/\/\s*<reference\s+path\s*=\s*["|'].*["|']\s*\/>\s*[\\n]?/
|
export let regexReferencePath = /\/\/\/\s*<reference\s+path\s*=\s*["|'].*["|']\s*\/>\s*[\\n]?/
|
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"ambientDependencies": {
|
|
||||||
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts",
|
|
||||||
"mocha": "github:Bartvds/tsd-deftools/typings/DefinitelyTyped/mocha/mocha.d.ts",
|
|
||||||
"colors": "github:DefinitelyTyped/DefinitelyTyped/colors/colors.d.ts"
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user