first working version
This commit is contained in:
		
							
								
								
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| node_modules/ | ||||
| docs/ | ||||
| coverage/ | ||||
| .nogit/ | ||||
							
								
								
									
										12
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							| @@ -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"; | ||||
| ``` | ||||
							
								
								
									
										1
									
								
								dist/index.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								dist/index.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| export * from "./lik.stringmap"; | ||||
							
								
								
									
										7
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -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== | ||||
							
								
								
									
										2
									
								
								dist/lik.plugins.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								dist/lik.plugins.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| import "typings-global"; | ||||
| export import q = require("q"); | ||||
							
								
								
									
										4
									
								
								dist/lik.plugins.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								dist/lik.plugins.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| "use strict"; | ||||
| require("typings-global"); | ||||
| exports.q = require("q"); | ||||
| //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlrLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9saWsucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBQ1YsU0FBQyxXQUFXLEdBQUcsQ0FBQyxDQUFDIn0= | ||||
							
								
								
									
										19
									
								
								dist/lik.stringmap.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								dist/lik.stringmap.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -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; | ||||
| } | ||||
							
								
								
									
										36
									
								
								dist/lik.stringmap.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								dist/lik.stringmap.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -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= | ||||
							
								
								
									
										29
									
								
								package.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								package.json
									
									
									
									
									
										Normal file
									
								
							| @@ -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" | ||||
|   } | ||||
| } | ||||
							
								
								
									
										2
									
								
								test/test.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								test/test.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| import "typings-test"; | ||||
| import "should"; | ||||
							
								
								
									
										32
									
								
								test/test.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								test/test.js
									
									
									
									
									
										Normal file
									
								
							| @@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJv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Q0FBQyxDQUFDLE1BQU0sQ0FBQyxFQUFFLENBQUMsSUFBSSxFQUFFLENBQUM7WUFDeEQsYUFBYSxDQUFDLFdBQVcsQ0FBQyxXQUFXLENBQUMsQ0FBQyxNQUFNLENBQUMsRUFBRSxDQUFDLElBQUksRUFBRSxDQUFDO1lBQ3hELGFBQWEsQ0FBQyxXQUFXLENBQUMsV0FBVyxDQUFDLENBQUMsTUFBTSxDQUFDLEVBQUUsQ0FBQyxJQUFJLEVBQUUsQ0FBQztRQUM1RCxDQUFDLENBQUMsQ0FBQztRQUNILEVBQUUsQ0FBQyx1Q0FBdUMsRUFBQztZQUN2QyxhQUFhLENBQUMsWUFBWSxDQUFDLFdBQVcsQ0FBQyxDQUFDO1lBQ3hDLGFBQWEsQ0FBQyxXQUFXLENBQUMsV0FBVyxDQUFDLENBQUMsTUFBTSxDQUFDLEVBQUUsQ0FBQyxLQUFLLEVBQUUsQ0FBQztRQUM3RCxDQUFDLENBQUMsQ0FBQztJQUNQLENBQUMsQ0FBQyxDQUFBO0FBQ04sQ0FBQyxDQUFDLENBQUMifQ== | ||||
							
								
								
									
										31
									
								
								test/test.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								test/test.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -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(); | ||||
|         }); | ||||
|     }) | ||||
| }); | ||||
							
								
								
									
										5
									
								
								ts/index.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								ts/index.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | ||||
| import * as plugins from "./lik.plugins"; | ||||
|  | ||||
| // import modules | ||||
|  | ||||
| export * from "./lik.stringmap"; | ||||
							
								
								
									
										2
									
								
								ts/lik.plugins.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								ts/lik.plugins.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| import "typings-global"; | ||||
| export import q = require("q");  | ||||
							
								
								
									
										35
									
								
								ts/lik.stringmap.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								ts/lik.stringmap.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -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; | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user