diff --git a/package/README.md b/package/README.md index fff0e78..eca7762 100644 --- a/package/README.md +++ b/package/README.md @@ -3,24 +3,380 @@ This is a service project for providing common functionality as a npm package. Below is a list of available features with a short description. -| # | Name | Description | -|----:|:--------------------|:-------------------------------------------------------------------------| -| 1 | classNames | Create class names from any type of objects | -| 2 | mergeObjects | Combine objects that go sequentially into groups | -| 3 | mergeStringArray | Combine array entries that go sequentially (add-on over mergeObjects) | -| 4 | limitNumber | Limit a certain number to an upper and lower bound | -| 5 | computeArrayWeights | Calculate weight of strings array items based on another string (query) | -| 6 | sortByWeights | Sort strings array by computed weights | -| 7 | computeProgress | Calculate progress (0-100) based on provided current, min and max values | -| 8 | compareStrings | Compare two strings with specific filters | -| 9 | cleanString | Clean string with or without regular expression | -| 10 | DateConverter | Convert date from unix or from date to selected format | -| 11 | StringExtractor | Extract special entries from string | -| 12 | StringProcessor | Modify strings with special properties | -| 13 | CacheController | Browser storage data controller | -| 14 | MakeFormData | Simplifying the creation of FormData objects | -| 15 | Random | Several random value generators | -| 16 | MakeElement | Plain html elements constructor | +## [Functions](#functions-usage) + +| # | Name | Description | +|----:|:-----------------------------------------------------|:-------------------------------------------------------------------------| +| 1 | [classNames](#classnames-function) | Create class names from any type of objects | +| 2 | [mergeObjects](#mergeobjects-function) | Combine objects that go sequentially into groups | +| 3 | [mergeStringArray](#mergestringarray-function) | Combine array entries that go sequentially (add-on over mergeObjects) | +| 4 | [limitNumber](#limitnumber-function) | Limit a certain number to an upper and lower bound | +| 5 | [computeArrayWeights](#computearrayweights-function) | Calculate weight of strings array items based on another string (query) | +| 6 | [sortByWeights](#sortbyweights-function) | Sort strings array by computed weights | +| 7 | [computeProgress](#computeprogress-function) | Calculate progress (0-100) based on provided current, min and max values | +| 8 | [compareStrings](#comparestrings-function) | Compare two strings with specific filters | +| 9 | [cleanString](#cleanstring-function) | Clean string with or without regular expression | +| 10 | [rotateArray](#rotatearray-function) | Rotate an array to specified direction by one or more steps | + +## [Classes](#classes-usage) + +| # | Name | Description | +|----:|:----------------------------------------------------------|:-------------------------------------------------------| +| 1 | [DateConverter](#dateconverter-class) | Convert date from unix or from date to selected format | +| 2 | [StringExtractor](#stringextractor-class) | Extract special entries from string | +| 3 | [StringProcessor](#stringprocessor-class) | Modify strings with special properties | +| 4 | [StorageController](#storagecontroller-class) | Browser storage data controller | +| 5 | [MakeFormData](#makeformdata-class) | Simplifying the creation of FormData objects | +| 6 | [Random](#random-class) | Several random value generators | +| 7 | [MakeElement (deprecated)](#makeelement-class-deprecated) | Plain html elements constructor | + +# Functions usage + +### classNames function + +- Signature: `(...args: any[]) => string`. + +A function to generate class names from objects of any type. All array type arguments will be flattened, objects will be +converted as `{[className]: Boolean}`. Each entry will be automatically truncated. + +```ts +classNames("hello", { world: true, "not": null }) // => "hello world" +``` + +
+ +### mergeObjects function + +- Signature: `(objects: TObject[], mergeKey: [ string, any ], minMergeLimit: number = 2) => TObject[]` + +Complicated function for merging objects with identical key by this scheme (for `A`): +`{ A, A, B, A, A, B, B } => { [A, A], B, [A, A], B B }`. The `minMergeLimit` property determines how many elements with +the selected key must be sequentially placed in one place for merging. + +```ts +mergeObjects([ { key: "A", text: "Hello" }, { key: "A", text: "World" }, { key: "B", text: "Not" } ], { key: "A" }) +``` + +```json5 +// Execution result +[ + [ + { + "key": "A", + "text": "Hello" + }, + { + "key": "A", + "text": "World" + } + ], + { + "key": "B", + "text": "Not" + } +] +``` + +
+ +### mergeStringArray function + +- Signature: `(array: string[], minMergeLimit: number = 2) => string[]` + +Works the same as mergeObjects, but for string arrays. + +
+ +### limitNumber function + +- Signature: `(value: number, top?: number | null, bottom?: number | null) => number` + +Limit a certain number to an upper and lower bound, pass null to remove specific bound and use next one. + +```ts +limitNumber(10, 5, 0) // => 5sortByWeights("Hello", ["ok", "good", "henlow", "henlo"]) + +limitNumber(15, null, 10) // => 15 + +limitNumber(-10, 5, 0) // => 0 +``` + +
+ +### computeArrayWeights function + +- Signature: `(query: string, array: string[]) => number[]` + +Calculates weight of the elements of a strings array based on a specific query. The less weight is better. + +```ts +computeArrayWeights("Hello", [ "henlo", "hellow", "okay", "goodbye" ]) +``` + +```json5 +// Execution result +[ + 0.0375234521575985, + 0, + 1.0793465577596266, + 0.6635071090047393 +] +``` + +
+ +### sortByWeights function + +- Signature: `(query: string, array: string[]) => string[]` + +Sorting the array of strings by the computed weights from the previous function. The entries most like the query will be +higher. + +```ts +sortByWeights("Hello", [ "ok", "good", "henlow", "henlo" ]) // => ["henlow", "henlo", "good", "ok"] +``` + +
+ +### computeProgress function + +- Signature: `(value: number, max = 100, min = 0) => number` + +Calculate progress (0-100) based on provided current, min and max values. Calculates using this +formula: `X = (A * 100) / (B - C)`. + +```ts +computeProgress(10, 200, 100) // => 10 +computeProgress(10, 200) // => 5 +``` + +
+ +### compareStrings function + +- Signature: `(a: string, b: string) => { result: boolean, weight: number }` + +Compare two strings with specific filters and returns comparison result (boolean) +and comparison weight (number, lower is better). + +```ts +compareStrings("Hello", "henlo") // => { "result": true, "weight": 0.0375234521575985 } + +compareStrings("Hello", "nothello") // => { "result": false, "weight": 0.707635009310987 } + +compareStrings("Hello", "hello") // => { "result": true, "weight": 0 } +``` + +
+ +### cleanString function + +- Signature: `(entry: string, cleanRegexp?: RegExp) => string` + +Cleaning a string with or without a regular expression. Automatically trim input and remove extra spaces. + +```ts +cleanString("Hello world ") // => "Hello world" +``` + +
+ +### rotateArray function + +- Signature: `(array: T, right = true, steps = 1) => T` + +Rotate an array to specified direction by one or more steps. + +```ts +rotateArray([ 1, 2, 3, 4, 5 ]) // => [5, 1, 2, 3, 4] + +rotateArray([ 1, 2, 3, 4, 5 ], true, 3) // => [3, 4, 5, 1, 2] + +rotateArray([ 1, 2, 3, 4, 5 ], false) // => [2, 3, 4, 5, 1] +``` + +
+ +# Classes usage + +## DateConverter class + +- Constructor signature: `(entry: Date | string | number, unix = true)` + +Utility class to convert date, javascript or unix timestamps to specific forms. + +### Methods list + +1. `toUnuxTimestamp() => number` - convert date to unix timestamp. +2. `toReadable (mappings: TMonthMappings = russianMonths, format: string = this.defaultReadableFormat) => string` - + convert date to human-readable format using name mappings and format property. + +### Mappings scheme + +```json5 +{ + casing: { + "regularEnding": "caseEnding" + }, + months: [ + "firstMonthName", + "secondMonthName", + "..." + ] +} +``` + +### Usage + +```ts +// Date.now() / 1000 is a unix timestamp +const converter = new DateConverter(Date.now() / 1000) + +converter.toReadable() // => 10 мая 2022 + +converter.toUnixTimestamp // => 1652187277 +``` + +# StringExtractor class + +- Constructor signature: `(public entry: string)` + +Utility class for retrieving specific entries defined as regular expressions from the provided string. + +### Methods list + +1. `get extract (): { entry: string; extracted: { [p: string]: string[]; }; }` - extract specific entities from string + using defined extractors. +2. `attach (...extractors: (RegExp | [ RegExp, string ])[]): this` - attach regular expression extractor to current + instance. + +### Usage + +```ts +const extractor = new StringExtractor("Hello !weird #world") + +extractor.attach(/#[A-z]*/g, [ /![A-z]*/, "excl" ]) + +extractor.extract // => { entry: 'Hello', extracted: { '#': [ 'world' ], excl: [ '!weird' ] } } + +// Extracted values can be accessed using extracted property +extractor.extracted // => same to extractor.extract method execution result + +// Also updated property extractor.entry, now it is equal to 'Hello' +``` + +# StringProcessor class + +- Constructor signature: `(public entry: string)` + +Utility class for modifying strings with special properties. + +### Methods list + +1. `get extractor () => StringExtractor` - get StringExtractor class instance. +2. `get wordsList () => string[]` - generate words array from current entry. +3. `get removeDuplicates () => this` - Remove duplicate words from entry using `mergeStringArray` utility function. + +_`removeDuplicate` method return StringProcessor class instance, removing result writing directly into entry._ + +4. `compare (value: string) => { result: boolean, weight: number }` - Compare current entry with specific string + using `compareStrings` function. +5. `get clean () => this` - clean entry string using cleanString function. +6. `limitWordsCount (limit: number, ellipsis: boolean = true, numbers = true) => this` - limit words count in current + entry _(act like `removeDuplicates`, writes result directly into entry)_. +7. `filter (...filters: (RegExp | string)[]) => this` - apply regular expressions or strings as filters + (like word filter) to the current entry. + +### Usage + +```ts +const processor = new StringProcessor("Hey, hello hello weird world!"); + +// will not work with upper/lower case and punctuation +processor.removeDuplicates; + +processor.entry // => 'Hey, hello weird world!' + +processor.wordsList // => [ 'Hey,', 'hello', 'weird', 'world!' ] + +// Cuz' this method write directly into entry, you cannot restore deleted words +processor.limitWordsCount(3) + +processor.entry // => Hey, hello weird... +``` + +# StorageController class + +- Constructor signature: `(public readonly storage: Storage)` + +An add-on over the native browser storage. Provides simplified interaction interface +(slower than native due to JSON transformations). + +### Methods list + +1. `getItem (key: string) => false | T` - get item from defined browser storage by a specific key and parse + item data like JSON content. +2. `setItem (key: string, value: T) => this` - stringify provided value and write it to the defined browser + storage. +3. `removeItem (key: string) => this` - remove item from defined browser storage. +4. `exist (key: string) => boolean` - check if specific key exists in the defined storage. + +### Usage + +```ts +const controller = new StorageController(localStorage); + +// Methods can be chained +controller.setItem("keyName", { key: "World" }); + +controller.getItem("keyName").key // => `World` +``` + +# MakeFormData class + +- Constructor signature: `(items?: { [key: string]: any })` + +Utility class for creating FormData objects that can be chained. + +### Methods list + +1. `fetchObject () => { method: string, body: FormData }` - get native FormData object as object suitable for the fetch + function. +2. `add (items: { [key: string]: any }, forceJson: boolean = false) => this` - an add-on over the native method for + adding a FormData object, allows simultaneous application of several elements + _(forceJson used to force non-file entries conversion as JSON objects)_. +3. `remove (...items: string[]) => this` - an add-on over the native remove method of the FormData object allows + deleting multiple items at the same time. + +_FormData can be accessed with `.entry` property of MakeFormData instance._ + +### Usage + +```ts +const formData = new MakeFormData(); + +formData.add({ key: "Hello world" }); + +formData.entry // => FormData + +formData.fetchObject // => { method: "POST", body: FormData } +``` + +# Random class + +- Constructor signature: `does not have a constructor` + +Utility class for generating various types of random values. + +// TODO: add Random class documentation + +# MakeElement class (deprecated) + +- Constructor signature: ` (tag: K)` + +Utility class for easily creating and manipulating HTML elements. + +_**@deprecated** (documentation can still be found in the sources or inside `bin/classes/MakeElement.d.ts`)_ re-knownout - https://github.com/re-knownout/
knownout@hotmail.com diff --git a/package/bin/classes/DateConverter.ts b/package/bin/classes/DateConverter.ts index f637219..22de34b 100644 --- a/package/bin/classes/DateConverter.ts +++ b/package/bin/classes/DateConverter.ts @@ -5,7 +5,7 @@ */ /** - * Utility function to convert date, javascript or unix + * Utility class to convert date, javascript or unix * timestamps to specific forms. */ export default class DateConverter @@ -63,8 +63,10 @@ export default class DateConverter let monthName = mappings.months[this.entry.getMonth()] as string; // Changing the ending to case specific - if (mappings.casing) Object.entries(mappings.casing).forEach(([ literal, replacer ]) => - monthName = monthName.replace(new RegExp(literal, "g"), replacer)); + if (mappings.casing) Object.entries(mappings.casing).forEach(([ literal, replacer ]) => { + const canProcess = monthName.slice(-literal.length) == literal; + if (canProcess) monthName = monthName.slice(0, -literal.length) + replacer; + }); // Shortcut for adding leading zeros const padStart = (value: number) => String(value).padStart(2, "0"); diff --git a/package/bin/classes/MakeElement.ts b/package/bin/classes/MakeElement.ts index 7aa4303..a265317 100644 --- a/package/bin/classes/MakeElement.ts +++ b/package/bin/classes/MakeElement.ts @@ -7,6 +7,8 @@ /** * Utility class for easily creating and * manipulating HTML elements. + * + * @deprecated */ export default class MakeElement { diff --git a/package/bin/classes/CacheController.ts b/package/bin/classes/StorageController.ts similarity index 92% rename from package/bin/classes/CacheController.ts rename to package/bin/classes/StorageController.ts index 4ae8597..afc8a67 100644 --- a/package/bin/classes/CacheController.ts +++ b/package/bin/classes/StorageController.ts @@ -8,7 +8,7 @@ * An add-on over the native browser storage. Provides simplified * interaction interface (slower than native due to JSON transformations). */ -export default class CacheController +export default class StorageController { /** * An add-on over the native browser storage. Provides simplified @@ -36,7 +36,7 @@ export default class CacheController * * @param key storage key (cacheKeysList). * @param value storage value. - * @return {this} CacheController instance. + * @return {this} StorageController instance. */ public setItem (key: string, value: T): this { this.storage.setItem(key, JSON.stringify(value)); @@ -46,7 +46,7 @@ export default class CacheController /** * Remove item from defined browser storage. * @param key storage key. - * @return {this} CacheController instance. + * @return {this} StorageController instance. */ public removeItem (key: string): this { this.storage.removeItem(key); diff --git a/package/bin/classes/tests/ConvertDate.test.ts b/package/bin/classes/tests/DateConverter.ts similarity index 100% rename from package/bin/classes/tests/ConvertDate.test.ts rename to package/bin/classes/tests/DateConverter.ts diff --git a/package/bin/classes/tests/CacheController.test.ts b/package/bin/classes/tests/StorageController.test.ts similarity index 86% rename from package/bin/classes/tests/CacheController.test.ts rename to package/bin/classes/tests/StorageController.test.ts index 6d10990..cf71242 100644 --- a/package/bin/classes/tests/CacheController.test.ts +++ b/package/bin/classes/tests/StorageController.test.ts @@ -4,13 +4,13 @@ * https://github.com/re-knownout/lib */ -import CacheController from "../CacheController"; +import StorageController from "../StorageController"; -describe("CacheController class tests", () => { +describe("StorageController class tests", () => { const key = "testNode", value = { value: "Hello world!" }; - const controller = new CacheController(localStorage); + const controller = new StorageController(localStorage); it("Storage read/write test", () => { controller.setItem(key, value); diff --git a/package/bin/functions/computeArrayWeights.ts b/package/bin/functions/computeArrayWeights.ts index 349e6c5..1b3e4e9 100644 --- a/package/bin/functions/computeArrayWeights.ts +++ b/package/bin/functions/computeArrayWeights.ts @@ -12,7 +12,7 @@ import compareStrings from "./compareStrings"; * @param {string[]} array values list. * @return {number[]} weights list. */ -function computeArrayWeights (query: string, array: string[]) { +function computeArrayWeights (query: string, array: string[]): number[] { return Array(array.length).fill(0) .map((item, index) => compareStrings(array[index], query).weight); } diff --git a/package/bin/functions/computeProgress.tsx b/package/bin/functions/computeProgress.tsx index 4f65784..357d65c 100644 --- a/package/bin/functions/computeProgress.tsx +++ b/package/bin/functions/computeProgress.tsx @@ -18,12 +18,12 @@ * @param {number} min minimum for current value (default - 0) * @return {number} computed progress */ -function computeProgress (value: number, max = 100, min = 0) { +function computeProgress (value: number, max = 100, min = 0): number { // A - current value // B - maximum (for current value) // C - minimum (for current value) - // X = ((A - C) * 100) / (B - C) - return ((value - min) * 100) / (max - min); + // X = (A * 100) / (B - C) + return (value * 100) / (max - min); } export default computeProgress; diff --git a/package/bin/functions/mergeObjects.ts b/package/bin/functions/mergeObjects.ts index 48c3ff0..edb915f 100644 --- a/package/bin/functions/mergeObjects.ts +++ b/package/bin/functions/mergeObjects.ts @@ -16,9 +16,10 @@ export type TObject = { [key: string | number | symbol]: any }; * @param {number} minMergeLimit minimum objects in sequence to be merged. * @return {TObject[]} generated object with merged entities. */ -function mergeObjects (objects: TObject[], mergeKey: [ string, any ], minMergeLimit: number = 2): TObject[] { +function mergeObjects (objects: TObject[], mergeKey: { [key: string]: string }, minMergeLimit: number = 2): TObject[] { // Copy objects list to local variable let objectsList = [ ...objects ]; + const currentMergeKey = Object.entries(mergeKey)[0]; // Sequence indexes container const sequencesList: [ number, number ][] = []; @@ -26,11 +27,11 @@ function mergeObjects (objects: TObject[], mergeKey: [ string, any ], minMergeLi objectsList.forEach((object, index) => { // Get key value from object if exist - const keyValue = object.hasOwnProperty(mergeKey[0]) ? object[mergeKey[0]] : null; + const keyValue = object.hasOwnProperty(currentMergeKey[0]) ? object[currentMergeKey[0]] : null; if (!keyValue) return; // If key-value pair matches... - if (keyValue == mergeKey[1]) { + if (keyValue == currentMergeKey[1]) { // ... update sequence start index if not updated yet. if (sequenceStartIndex < 0) sequenceStartIndex = index; } else { diff --git a/package/bin/functions/mergeStringArray.ts b/package/bin/functions/mergeStringArray.ts index 6bd14cf..a64f0d3 100644 --- a/package/bin/functions/mergeStringArray.ts +++ b/package/bin/functions/mergeStringArray.ts @@ -25,7 +25,7 @@ export default function mergeStringArray (array: string[], minMergeLimit: number // Merging each unique sequence of entities (this can be slow). Array.from(new Set(array)).forEach(entry => - generated = mergeObjects(generated, [ "value", entry ], minMergeLimit)); + generated = mergeObjects(generated, { value: entry }, minMergeLimit)); return generated.map(item => Array.isArray(item) ? item.map(e => e.value) : item.value) as string[]; diff --git a/package/bin/functions/rotateArray.ts b/package/bin/functions/rotateArray.ts new file mode 100644 index 0000000..5f094b2 --- /dev/null +++ b/package/bin/functions/rotateArray.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2022 Alexandr knownout@hotmail.com + * Licensed under the GNU Affero General Public License v3.0 License (AGPL-3.0) + * https://github.com/re-knownout/lib + */ + +/** + * Utility function to rotate array entries. + * + * _This function does not affect the original array._ + * + * @param {any[]} array entry array (stay the same). + * @param right + * @param steps rotations count. + * @return {any[]} rotated array. + */ +export default function rotateArray (array: T, right = true, steps = 1): T { + const rotate = (array: any[], right: boolean) => { + if (right) return [ + array.slice(-1)[0], + ...array.slice(0, -1) + ]; + + return [ + ...array.slice(1), + array[0] + ]; + }; + + let rotated = rotate(array as any, right); + if (steps - 1 > 0) for (let i = 0; i < steps - 1; i++) + rotated = rotate(rotated, right); + + return rotated as any as T; +} diff --git a/package/bin/functions/tests/computeProgress.test.ts b/package/bin/functions/tests/computeProgress.test.ts index 9565d33..56e8c2b 100644 --- a/package/bin/functions/tests/computeProgress.test.ts +++ b/package/bin/functions/tests/computeProgress.test.ts @@ -7,5 +7,6 @@ import computeProgress from "../computeProgress"; it("computeProgress function test", () => { - expect(computeProgress(1000, 1500, 500)).toEqual(50); + expect(computeProgress(10, 200, 100)).toEqual(10); + expect(computeProgress(10, 200, 0)).toEqual(5); }); diff --git a/package/bin/functions/tests/mergeObjects.test.ts b/package/bin/functions/tests/mergeObjects.test.ts index acfe1db..ee44612 100644 --- a/package/bin/functions/tests/mergeObjects.test.ts +++ b/package/bin/functions/tests/mergeObjects.test.ts @@ -70,14 +70,14 @@ const testObjectTransform = [ describe("mergeObject function test", () => { it("Mixed object triple merging test", () => - expect(mergeObjects(testObjects[0], [ "type", "cat" ])).toEqual(testObjectTransform[0]) + expect(mergeObjects(testObjects[0], { type: "cat" })).toEqual(testObjectTransform[0]) ); it("Mixed object without merging test", () => - expect(mergeObjects(testObjects[1], [ "type", "cat" ])).toEqual(testObjectTransform[1]) + expect(mergeObjects(testObjects[1], { type: "cat" })).toEqual(testObjectTransform[1]) ); it("Object with identical elements test", () => - expect(mergeObjects(testObjects[2], [ "type", "cat" ])).toEqual(testObjectTransform[2]) + expect(mergeObjects(testObjects[2], { type: "cat" })).toEqual(testObjectTransform[2]) ); }); diff --git a/package/bin/functions/tests/rotateArray.test.ts b/package/bin/functions/tests/rotateArray.test.ts new file mode 100644 index 0000000..177dfb4 --- /dev/null +++ b/package/bin/functions/tests/rotateArray.test.ts @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Alexandr knownout@hotmail.com + * Licensed under the GNU Affero General Public License v3.0 License (AGPL-3.0) + * https://github.com/re-knownout/lib + */ + +import rotateArray from "../rotateArray"; + +it("rotateArray function test", () => { + expect(rotateArray([ 1, 2, 3, 4, 5 ])).toStrictEqual([ 5, 1, 2, 3, 4 ]); + expect(rotateArray([ 1, 2, 3, 4, 5 ], false)).toStrictEqual([ 2, 3, 4, 5, 1 ]); + + expect(rotateArray([ 1, 2, 3, 4, 5 ], true, 3)).toStrictEqual([ 3, 4, 5, 1, 2 ]); + expect(rotateArray([ 1, 2, 3, 4, 5 ], false, 3)) + .toStrictEqual([ 4, 5, 1, 2, 3 ]); +}); diff --git a/package/lib.ts b/package/lib.ts index 8754e89..ed970aa 100644 --- a/package/lib.ts +++ b/package/lib.ts @@ -4,7 +4,7 @@ * https://github.com/re-knownout/lib */ -import CacheController from "./bin/classes/CacheController"; +import StorageController from "./bin/classes/StorageController"; import DateConverter from "./bin/classes/DateConverter"; import MakeElement from "./bin/classes/MakeElement"; import MakeFormData from "./bin/classes/MakeFormData"; @@ -21,6 +21,7 @@ import compareStrings from "./bin/functions/compareStrings"; import computeProgress from "./bin/functions/computeProgress"; import computeArrayWeights from "./bin/functions/computeArrayWeights"; import sortByWeights from "./bin/functions/sortByWeights"; +import rotateArray from "./bin/functions/rotateArray"; export { classNames, @@ -32,11 +33,12 @@ export { computeProgress, computeArrayWeights, sortByWeights, + rotateArray, DateConverter, StringExtractor, StringProcessor, - CacheController, + StorageController, MakeFormData, Random, MakeElement diff --git a/package/package.json b/package/package.json index 0ce6982..9cdb186 100644 --- a/package/package.json +++ b/package/package.json @@ -1,6 +1,6 @@ { "name": "@knownout/lib", - "version": "0.1.0", + "version": "0.1.1", "author": "Alexandr knownout@hotmail.com", "license": "AGPL-3.0", "description": "Utility functions library", diff --git a/webpack.package.js b/webpack.package.js index 84fe3b9..78b90f7 100644 --- a/webpack.package.js +++ b/webpack.package.js @@ -13,7 +13,8 @@ const packageConfig = Object.assign(defaultConfig, { }, entry: { - lib: path.resolve(__dirname, "package", "lib") + lib: path.resolve(__dirname, "package", "lib"), + "bin/classes/DateConverter": path.resolve(__dirname, "package", "bin", "classes", "DateConverter") }, plugins: []