diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0dfb491..8321aed 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -34,31 +34,6 @@ snyk: - docker - notpriv -sast: - stage: security - image: registry.gitlab.com/hosttoday/ht-docker-dbase:npmci - variables: - DOCKER_DRIVER: overlay2 - allow_failure: true - services: - - docker:stable-dind - script: - - npmci npm prepare - - npmci npm install - - npmci command npm run build - - export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/') - - docker run - --env SAST_CONFIDENCE_LEVEL="${SAST_CONFIDENCE_LEVEL:-3}" - --volume "$PWD:/code" - --volume /var/run/docker.sock:/var/run/docker.sock - "registry.gitlab.com/gitlab-org/security-products/sast:$SP_VERSION" /app/bin/run /code - artifacts: - reports: - sast: gl-sast-report.json - tags: - - docker - - priv - # ==================== # test stage # ==================== diff --git a/README.md b/README.md index 36ef5b2..dc4f548 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,20 @@ -# smartstring - +# @pushrocks/smartstring handle strings in smart ways. TypeScript ready. -## Availabililty - -[![npm](https://pushrocks.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/smartstring) -[![git](https://pushrocks.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/smartstring) -[![git](https://pushrocks.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/pushrocks/smartstring) -[![docs](https://pushrocks.gitlab.io/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/smartstring/) +## Availabililty and Links +* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartstring) +* [gitlab.com (source)](https://gitlab.com/pushrocks/smartstring) +* [github.com (source mirror)](https://github.com/pushrocks/smartstring) +* [docs (typedoc)](https://pushrocks.gitlab.io/smartstring/) ## Status for master - -[![build status](https://GitLab.com/pushrocks/smartstring/badges/master/build.svg)](https://GitLab.com/pushrocks/smartstring/commits/master) -[![coverage report](https://GitLab.com/pushrocks/smartstring/badges/master/coverage.svg)](https://GitLab.com/pushrocks/smartstring/commits/master) -[![npm downloads per month](https://img.shields.io/npm/dm/smartstring.svg)](https://www.npmjs.com/package/smartstring) -[![Dependency Status](https://david-dm.org/pushrocks/smartstring.svg)](https://david-dm.org/pushrocks/smartstring) -[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/smartstring/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/smartstring/master/dependencies/npm) -[![bitHound Code](https://www.bithound.io/github/pushrocks/smartstring/badges/code.svg)](https://www.bithound.io/github/pushrocks/smartstring) -[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/) -[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/) -[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) +[![build status](https://gitlab.com/pushrocks/smartstring/badges/master/build.svg)](https://gitlab.com/pushrocks/smartstring/commits/master) +[![coverage report](https://gitlab.com/pushrocks/smartstring/badges/master/coverage.svg)](https://gitlab.com/pushrocks/smartstring/commits/master) +[![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/smartstring.svg)](https://www.npmjs.com/package/@pushrocks/smartstring) +[![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/smartstring/badge.svg)](https://snyk.io/test/npm/@pushrocks/smartstring) +[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) +[![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) +[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://prettier.io/) ## Usage @@ -63,8 +58,9 @@ smartstring.indent.indent('somestringanotherstring', '>>>> '); // indents a stri smartstring.indent.normalize(' somestring anotherstring', '>>>> '); // looks for the least amount of indention and removes superflouous space ``` -For further information read the linked docs at the top of this README. +For further information read the linked docs at the top of this readme. > MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) +| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html) -[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks) +[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://maintainedby.lossless.com) diff --git a/npmextra.json b/npmextra.json index 680f720..52d5ce4 100644 --- a/npmextra.json +++ b/npmextra.json @@ -7,5 +7,15 @@ "baseImage": "hosttoday/ht-docker-node:npmci", "command": "npmci node install stable && npmci npm install && npmci npm test", "dockerSock": false + }, + "gitzone": { + "module": { + "githost": "gitlab.com", + "gitscope": "pushrocks", + "gitrepo": "smartstring", + "shortDescription": "handle strings in smart ways. TypeScript ready.", + "npmPackagename": "@pushrocks/smartstring", + "license": "MIT" + } } } \ No newline at end of file diff --git a/package.json b/package.json index 2895b3e..399a2b2 100644 --- a/package.json +++ b/package.json @@ -39,4 +39,4 @@ "randomatic": "^3.1.1", "strip-indent": "^2.0.0" } -} +} \ No newline at end of file diff --git a/test/test.normalize.ts b/test/test.normalize.ts index 8995ab4..5b3141c 100644 --- a/test/test.normalize.ts +++ b/test/test.normalize.ts @@ -6,14 +6,14 @@ tap.test('should normalize a string', async () => { const testString = ` myawesome string; is indented with two spaces - ` + `; const normalizedString = smartstring.normalize.standard(testString); expect(normalizedString).to.equal( -` + ` myawesome string; is indented with two spaces ` - ) -}) + ); +}); -tap.start() \ No newline at end of file +tap.start(); diff --git a/ts/smartstring.create.ts b/ts/smartstring.create.ts index 5072523..5133f07 100644 --- a/ts/smartstring.create.ts +++ b/ts/smartstring.create.ts @@ -2,12 +2,12 @@ import * as plugins from './smartstring.plugins'; /** * creates a random string - * + * * ```ts * createRandomString('AAAA') - * //=> 'AGHR' + * //=> 'AGHR' * ``` - * + * * @param patternArg the pattern argument to use, Aa0!* are viable pattern descritors * @param lengthArg the length of the random string * @param optionsArg options diff --git a/ts/smartstring.domain.ts b/ts/smartstring.domain.ts index 3d66ba9..63042da 100644 --- a/ts/smartstring.domain.ts +++ b/ts/smartstring.domain.ts @@ -46,7 +46,7 @@ export class Domain { // helper functions /** */ - private _domainRegex (stringArg: string) { + private _domainRegex(stringArg: string) { const 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 regexMatches = regexString.exec(stringArg); regexMatches.reverse(); //make sure we build the domain from toplevel to subdomain (reversed order) @@ -57,7 +57,7 @@ export class Domain { return regexMatchesFiltered; } - private _protocolRegex (stringArg: string) { + private _protocolRegex(stringArg: string) { const regexString = /^([a-zA-Z0-9]*):\/\//; const regexMatches = regexString.exec(stringArg); if (regexMatches) { @@ -67,7 +67,7 @@ export class Domain { } } - private _portRegex (stringArg: string) { + private _portRegex(stringArg: string) { const regexString = /^([a-zA-Z0-9]*):\/\//; const regexMatches = regexString.exec(stringArg); if (regexMatches) { @@ -76,5 +76,4 @@ export class Domain { return undefined; } } - } diff --git a/ts/smartstring.plugins.ts b/ts/smartstring.plugins.ts index 33ac07d..98df9ab 100644 --- a/ts/smartstring.plugins.ts +++ b/ts/smartstring.plugins.ts @@ -2,10 +2,7 @@ import * as crypto from 'crypto'; import * as url from 'url'; -export { - crypto, - url -}; +export { crypto, url }; // third party export let jsBase64 = require('js-base64').Base64; @@ -14,4 +11,3 @@ export let stripIndent = require('strip-indent'); export let normalizeNewline = require('normalize-newline'); export let randomatic = require('randomatic'); export let cryptoRandomString = require('crypto-random-string'); -