refactor method names

This commit is contained in:
Philipp Kunz 2017-07-17 17:01:10 +02:00
parent 74b52173dd
commit d29fd78753
6 changed files with 76 additions and 13 deletions

6
dist/index.d.ts vendored
View File

@ -1,9 +1,9 @@
/**
* returns short strings that are unique to very high degree od certainty
*/
export declare let getShortId: () => string;
export declare let shortId: () => string;
/**
* returns strings that are unique to a very high degree of certainty
*/
export declare let getUuidv4: () => string;
export declare let getUuidv5: (customStringArg: string, namespaceArg?: any) => string;
export declare let uuid4: () => string;
export declare let uuid5: (customStringArg: string, namespaceArg?: any) => string;

8
dist/index.js vendored
View File

@ -4,16 +4,16 @@ const plugins = require("./smartunique.plugins");
/**
* returns short strings that are unique to very high degree od certainty
*/
exports.getShortId = () => {
exports.shortId = () => {
return plugins.shortid.generate();
};
/**
* returns strings that are unique to a very high degree of certainty
*/
exports.getUuidv4 = () => {
exports.uuid4 = () => {
return plugins.uuidv4();
};
exports.getUuidv5 = (customStringArg, namespaceArg = plugins.uuidv5.DNS) => {
exports.uuid5 = (customStringArg, namespaceArg = plugins.uuidv5.DNS) => {
return plugins.uuidv5(customStringArg, namespaceArg);
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLGlEQUFnRDtBQUVoRDs7R0FFRztBQUNRLFFBQUEsVUFBVSxHQUFHO0lBQ3RCLE1BQU0sQ0FBQyxPQUFPLENBQUMsT0FBTyxDQUFDLFFBQVEsRUFBRSxDQUFBO0FBQ25DLENBQUMsQ0FBQTtBQUVEOztHQUVHO0FBQ1EsUUFBQSxTQUFTLEdBQUc7SUFDckIsTUFBTSxDQUFDLE9BQU8sQ0FBQyxNQUFNLEVBQUUsQ0FBQTtBQUN6QixDQUFDLENBQUE7QUFFVSxRQUFBLFNBQVMsR0FBRyxDQUFDLGVBQXVCLEVBQUUsWUFBWSxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsR0FBRztJQUNoRixNQUFNLENBQUMsT0FBTyxDQUFDLE1BQU0sQ0FBQyxlQUFlLEVBQUUsWUFBWSxDQUFDLENBQUE7QUFDdEQsQ0FBQyxDQUFBIn0=
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLGlEQUFnRDtBQUVoRDs7R0FFRztBQUNRLFFBQUEsT0FBTyxHQUFHO0lBQ25CLE1BQU0sQ0FBQyxPQUFPLENBQUMsT0FBTyxDQUFDLFFBQVEsRUFBRSxDQUFBO0FBQ25DLENBQUMsQ0FBQTtBQUVEOztHQUVHO0FBQ1EsUUFBQSxLQUFLLEdBQUc7SUFDakIsTUFBTSxDQUFDLE9BQU8sQ0FBQyxNQUFNLEVBQUUsQ0FBQTtBQUN6QixDQUFDLENBQUE7QUFFVSxRQUFBLEtBQUssR0FBRyxDQUFDLGVBQXVCLEVBQUUsWUFBWSxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsR0FBRztJQUM1RSxNQUFNLENBQUMsT0FBTyxDQUFDLE1BQU0sQ0FBQyxlQUFlLEVBQUUsWUFBWSxDQUFDLENBQUE7QUFDdEQsQ0FBQyxDQUFBIn0=

45
docs/index.md Normal file
View File

@ -0,0 +1,45 @@
# smartunique
make things unique
## Availabililty
[![npm](https://pushrocks.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/smartunique)
[![git](https://pushrocks.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/smartunique)
[![git](https://pushrocks.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/pushrocks/smartunique)
[![docs](https://pushrocks.gitlab.io/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/smartunique/)
## Status for master
[![build status](https://GitLab.com/pushrocks/smartunique/badges/master/build.svg)](https://GitLab.com/pushrocks/smartunique/commits/master)
[![coverage report](https://GitLab.com/pushrocks/smartunique/badges/master/coverage.svg)](https://GitLab.com/pushrocks/smartunique/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/smartunique.svg)](https://www.npmjs.com/package/smartunique)
[![Dependency Status](https://david-dm.org/pushrocks/smartunique.svg)](https://david-dm.org/pushrocks/smartunique)
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/smartunique/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/smartunique/master/dependencies/npm)
[![bitHound Code](https://www.bithound.io/github/pushrocks/smartunique/badges/code.svg)](https://www.bithound.io/github/pushrocks/smartunique)
[![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/)
## Usage
Use TypeScript for best in class instellisense.
```javascript
// We are using TypeScript syntax here to have types in place
import * as smartunique from 'smartunique'
// creates a short mathematically highly unique short string
let myShortid = smartunique.shortid()
// creates a string that is possibly unique world wide
let myUuid4 = smartunique.uuid4()
// creates a oneway repeatable unique id within a certain namespace
let myUuid5 = smartunique.uuid('myobscureduser@somedomain.com', smartunique.uuid4())
```
Learn more about UUIDs: knowledgebase.gitzone.com/uuid.html
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)

View File

@ -9,6 +9,19 @@
"scripts": {
"test": "(npmts)"
},
"repository": {
"type": "git",
"url": "https://gitlab.com/pushrocks/smartunique.git"
},
"keywords": [
"unique",
"key",
"uuid",
"shortid",
"lossless",
"pushrocks",
"TypeScript"
],
"devDependencies": {
"tapbundle": "^1.0.13"
},

View File

@ -2,17 +2,22 @@ import { expect, tap } from 'tapbundle'
import * as smartunique from '../dist/index'
tap.test('should create shortid', async () => {
let result = smartunique.getShortId()
let result = smartunique.shortId()
console.log(result)
})
tap.test('should create uuidv4', async () => {
let result = smartunique.getUuidv4()
let result = smartunique.uuid4()
console.log(result)
})
tap.test('should create uuidv5', async () => {
let result = smartunique.getUuidv5('sometext')
let result = smartunique.uuid5('sometext')
console.log(result)
})
tap.test('should create uuidv5 within namespace', async () => {
let result = smartunique.uuid5('sometext', smartunique.uuid4())
console.log(result)
})

View File

@ -3,17 +3,17 @@ import * as plugins from './smartunique.plugins'
/**
* returns short strings that are unique to very high degree od certainty
*/
export let getShortId = (): string => {
export let shortId = (): string => {
return plugins.shortid.generate()
}
/**
* returns strings that are unique to a very high degree of certainty
*/
export let getUuidv4 = (): string => {
export let uuid4 = (): string => {
return plugins.uuidv4()
}
export let getUuidv5 = (customStringArg: string, namespaceArg = plugins.uuidv5.DNS): string => {
export let uuid5 = (customStringArg: string, namespaceArg = plugins.uuidv5.DNS): string => {
return plugins.uuidv5(customStringArg, namespaceArg)
}