commit 35f8f1e9b8edc564d966b5cbb0c91b6486e62cde Author: PhilKunz Date: Fri Jul 22 00:16:45 2016 +0200 first working version diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c3efab --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +node_modules/ +docs/ +coverage/ +.nogit/ \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..421217b --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +# lik +light little helpers for node + +## Status + +## Usage +We recommend the use of TypeScript for good intellisense. + +```typescript +// import any tool that you need from lik +import {Stringmap} from "lik"; +``` \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts new file mode 100644 index 0000000..878e20c --- /dev/null +++ b/dist/index.d.ts @@ -0,0 +1 @@ +export * from "./lik.stringmap"; diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..fdfcf48 --- /dev/null +++ b/dist/index.js @@ -0,0 +1,7 @@ +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +// import modules +__export(require("./lik.stringmap")); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O0FBRUEsaUJBQWlCO0FBRWpCLGlCQUFjLGlCQUFpQixDQUFDLEVBQUEifQ== \ No newline at end of file diff --git a/dist/lik.plugins.d.ts b/dist/lik.plugins.d.ts new file mode 100644 index 0000000..cf0fd4f --- /dev/null +++ b/dist/lik.plugins.d.ts @@ -0,0 +1,2 @@ +import "typings-global"; +export import q = require("q"); diff --git a/dist/lik.plugins.js b/dist/lik.plugins.js new file mode 100644 index 0000000..0d2318c --- /dev/null +++ b/dist/lik.plugins.js @@ -0,0 +1,4 @@ +"use strict"; +require("typings-global"); +exports.q = require("q"); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlrLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9saWsucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBQ1YsU0FBQyxXQUFXLEdBQUcsQ0FBQyxDQUFDIn0= \ No newline at end of file diff --git a/dist/lik.stringmap.d.ts b/dist/lik.stringmap.d.ts new file mode 100644 index 0000000..9f521aa --- /dev/null +++ b/dist/lik.stringmap.d.ts @@ -0,0 +1,19 @@ +/** + * allows you to easily keep track of a bunch of strings; + */ +export declare class Stringmap { + private _stringArray; + constructor(); + /** + * add a string to the Stringmap + */ + addString(stringArg: string): void; + /** + * removes a string from Stringmap + */ + removeString(stringArg: string): void; + /** + * check if string is in Stringmap + */ + checkString(stringArg: string): boolean; +} diff --git a/dist/lik.stringmap.js b/dist/lik.stringmap.js new file mode 100644 index 0000000..f70d020 --- /dev/null +++ b/dist/lik.stringmap.js @@ -0,0 +1,36 @@ +"use strict"; +/** + * allows you to easily keep track of a bunch of strings; + */ +class Stringmap { + constructor() { + this._stringArray = []; + } + ; + /** + * add a string to the Stringmap + */ + addString(stringArg) { + this._stringArray.push(stringArg); + } + ; + /** + * removes a string from Stringmap + */ + removeString(stringArg) { + for (let keyArg in this._stringArray) { + if (this._stringArray[keyArg] == stringArg) { + this._stringArray.splice(parseInt(keyArg), 1); + } + ; + } + } + /** + * check if string is in Stringmap + */ + checkString(stringArg) { + return this._stringArray.indexOf(stringArg) != -1; + } +} +exports.Stringmap = Stringmap; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlrLnN0cmluZ21hcC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2xpay5zdHJpbmdtYXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUVBOztHQUVHO0FBQ0g7SUFFSTtRQURRLGlCQUFZLEdBQVksRUFBRSxDQUFDO0lBR25DLENBQUM7O0lBQ0Q7O09BRUc7SUFDSCxTQUFTLENBQUMsU0FBZ0I7UUFDdEIsSUFBSSxDQUFDLFlBQVksQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLENBQUM7SUFDdEMsQ0FBQzs7SUFFRDs7T0FFRztJQUNILFlBQVksQ0FBQyxTQUFnQjtRQUN6QixHQUFHLENBQUMsQ0FBQyxJQUFJLE1BQU0sSUFBSSxJQUFJLENBQUMsWUFBWSxDQUFDLENBQUEsQ0FBQztZQUNsQyxFQUFFLENBQUEsQ0FBQyxJQUFJLENBQUMsWUFBWSxDQUFDLE1BQU0sQ0FBQyxJQUFJLFNBQVMsQ0FBQyxDQUFBLENBQUM7Z0JBQ3ZDLElBQUksQ0FBQyxZQUFZLENBQUMsTUFBTSxDQUFDLFFBQVEsQ0FBQyxNQUFNLENBQUMsRUFBQyxDQUFDLENBQUMsQ0FBQztZQUNqRCxDQUFDO1lBQUEsQ0FBQztRQUNOLENBQUM7SUFDTCxDQUFDO0lBRUQ7O09BRUc7SUFDSCxXQUFXLENBQUMsU0FBZ0I7UUFDeEIsTUFBTSxDQUFDLElBQUksQ0FBQyxZQUFZLENBQUMsT0FBTyxDQUFDLFNBQVMsQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDO0lBQ3RELENBQUM7QUFDTCxDQUFDO0FBN0JZLGlCQUFTLFlBNkJyQixDQUFBIn0= \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..dfd2a92 --- /dev/null +++ b/package.json @@ -0,0 +1,29 @@ +{ + "name": "lik", + "version": "1.0.0", + "description": "light little helpers for node", + "main": "dist/index.js", + "typings": "dist/index.d.ts", + "scripts": { + "test": "(npmts)" + }, + "repository": { + "type": "git", + "url": "git+ssh://git@gitlab.com/pushrocks/lik.git" + }, + "author": "Lossless GmbH", + "license": "MIT", + "bugs": { + "url": "https://gitlab.com/pushrocks/lik/issues" + }, + "homepage": "https://gitlab.com/pushrocks/lik#README", + "devDependencies": { + "npmts-g": "^5.2.6", + "should": "^10.0.0", + "typings-test": "^1.0.1" + }, + "dependencies": { + "@types/q": "^0.0.27", + "q": "^1.4.1" + } +} diff --git a/test/test.d.ts b/test/test.d.ts new file mode 100644 index 0000000..b973566 --- /dev/null +++ b/test/test.d.ts @@ -0,0 +1,2 @@ +import "typings-test"; +import "should"; diff --git a/test/test.js b/test/test.js new file mode 100644 index 0000000..ba04686 --- /dev/null +++ b/test/test.js @@ -0,0 +1,32 @@ +"use strict"; +require("typings-test"); +const lik = require("../dist/index"); +require("should"); +describe("lik", function () { + describe("Stringmap", function () { + let testStringmap; + let testString1 = "testString1"; + let testString2 = "testString2"; + let testString3 = "testString3"; + it("should create an instance of Stringmap", function () { + testStringmap = new lik.Stringmap(); + testStringmap.should.be.instanceof(lik.Stringmap); + }); + it("should return false for an string not in Stringmap", function () { + testStringmap.checkString(testString1).should.be.false(); + }); + it("should add an string to Stringmap", function () { + testStringmap.addString(testString1); + testStringmap.addString(testString2); + testStringmap.addString(testString3); + testStringmap.checkString(testString1).should.be.true(); + testStringmap.checkString(testString2).should.be.true(); + testStringmap.checkString(testString3).should.be.true(); + }); + it("should remove a string from Stringmap", function () { + testStringmap.removeString(testString2); + testStringmap.checkString(testString2).should.be.false(); + }); + }); +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FBYyxDQUFDLENBQUE7QUFDdEIsTUFBTyxHQUFHLFdBQVcsZUFBZSxDQUFDLENBQUM7QUFDdEMsUUFBTyxRQUFRLENBQUMsQ0FBQTtBQUVoQixRQUFRLENBQUMsS0FBSyxFQUFDO0lBQ1gs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QUFDLEVBQUUsQ0FBQyxJQUFJLEVBQUUsQ0FBQztRQUM1RCxDQUFDLENBQUMsQ0FBQztRQUNILEVBQUUsQ0FBQyx1Q0FBdUMsRUFBQztZQUN2QyxhQUFhLENBQUMsWUFBWSxDQUFDLFdBQVcsQ0FBQyxDQUFDO1lBQ3hDLGFBQWEsQ0FBQyxXQUFXLENBQUMsV0FBVyxDQUFDLENBQUMsTUFBTSxDQUFDLEVBQUUsQ0FBQyxLQUFLLEVBQUUsQ0FBQztRQUM3RCxDQUFDLENBQUMsQ0FBQztJQUNQLENBQUMsQ0FBQyxDQUFBO0FBQ04sQ0FBQyxDQUFDLENBQUMifQ== \ No newline at end of file diff --git a/test/test.ts b/test/test.ts new file mode 100644 index 0000000..7e06dd6 --- /dev/null +++ b/test/test.ts @@ -0,0 +1,31 @@ +import "typings-test"; +import lik = require("../dist/index"); +import "should"; + +describe("lik",function(){ + describe("Stringmap",function(){ + let testStringmap:lik.Stringmap; + let testString1 = "testString1"; + let testString2 = "testString2"; + let testString3 = "testString3"; + it("should create an instance of Stringmap",function(){ + testStringmap = new lik.Stringmap(); + testStringmap.should.be.instanceof(lik.Stringmap); + }); + it("should return false for an string not in Stringmap",function(){ + testStringmap.checkString(testString1).should.be.false(); + }); + it("should add an string to Stringmap",function(){ + testStringmap.addString(testString1); + testStringmap.addString(testString2); + testStringmap.addString(testString3); + testStringmap.checkString(testString1).should.be.true(); + testStringmap.checkString(testString2).should.be.true(); + testStringmap.checkString(testString3).should.be.true(); + }); + it("should remove a string from Stringmap",function(){ + testStringmap.removeString(testString2); + testStringmap.checkString(testString2).should.be.false(); + }); + }) +}); \ No newline at end of file diff --git a/ts/index.ts b/ts/index.ts new file mode 100644 index 0000000..d2cee77 --- /dev/null +++ b/ts/index.ts @@ -0,0 +1,5 @@ +import * as plugins from "./lik.plugins"; + +// import modules + +export * from "./lik.stringmap"; \ No newline at end of file diff --git a/ts/lik.plugins.ts b/ts/lik.plugins.ts new file mode 100644 index 0000000..f96859a --- /dev/null +++ b/ts/lik.plugins.ts @@ -0,0 +1,2 @@ +import "typings-global"; +export import q = require("q"); \ No newline at end of file diff --git a/ts/lik.stringmap.ts b/ts/lik.stringmap.ts new file mode 100644 index 0000000..dc5a7b3 --- /dev/null +++ b/ts/lik.stringmap.ts @@ -0,0 +1,35 @@ +import * as plugins from "./lik.plugins"; + +/** + * allows you to easily keep track of a bunch of strings; + */ +export class Stringmap { + private _stringArray:string[] = []; + constructor(){ + + }; + /** + * add a string to the Stringmap + */ + addString(stringArg:string){ + this._stringArray.push(stringArg); + }; + + /** + * removes a string from Stringmap + */ + removeString(stringArg:string){ + for (let keyArg in this._stringArray){ + if(this._stringArray[keyArg] == stringArg){ + this._stringArray.splice(parseInt(keyArg),1); + }; + } + } + + /** + * check if string is in Stringmap + */ + checkString(stringArg:string):boolean{ + return this._stringArray.indexOf(stringArg) != -1; + } +} \ No newline at end of file