Skip to content
This repository has been archived by the owner on Dec 22, 2022. It is now read-only.

Commit

Permalink
build update
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisweb committed Aug 21, 2020
1 parent 0a20164 commit 88abcc5
Show file tree
Hide file tree
Showing 24 changed files with 811 additions and 323 deletions.
13 changes: 13 additions & 0 deletions dist/@types/chrisweb-utilities/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { getTimestamp } from './utilities/datetime';
import { isServer, isClient } from './utilities/platform';
import { getUrlParameters, getUrlParameterByName, replaceUrlParameter } from './utilities/url';
import { decodeUri, encodeUri } from './utilities/uri';
import { removeString, isArray, includes, find, flat } from './utilities/array';
import { filterAlphaNumericPlus, capitaliseFirstLetter, stringContains, getSubstringIndex, replacePlaceholders } from './utilities/string';
import { generateUUID } from './utilities/uuid';
import { removeElements } from './utilities/html';
import { log } from './utilities/log';
import { sleep } from './utilities/helper';
import { randomInteger } from './utilities/random';
declare const version = "1.0.0";
export { version, getTimestamp, isServer, isClient, getUrlParameters, getUrlParameterByName, replaceUrlParameter, decodeUri, encodeUri, removeString, isArray, includes, find, flat, filterAlphaNumericPlus, capitaliseFirstLetter, stringContains, getSubstringIndex, replacePlaceholders, generateUUID, removeElements, log, sleep, randomInteger };
42 changes: 42 additions & 0 deletions dist/@types/chrisweb-utilities/utilities/array.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
* finds "removeMe" and removes it from the array
* @param array
* @param removeMe
*/
declare const removeString: (myArray: string[], removeMe: string) => string[];
/**
* is array with polyfill for older browsers
* @param input
*/
declare const isArray: (input: unknown) => boolean;
declare global {
interface Array<T> {
includes(valueToFind: string, fromIndex?: number): boolean;
}
}
/**
* finds "toFind" in an array, starting at an optional index
* @param inputArray
* @param toFind
* @param fromIndex
*/
declare const includes: (inputArray: [], toFind: string, fromIndex?: number) => boolean;
/**
*
* @param inputArray
* @param predicate
* @param args
*/
declare const find: (inputArray: [], predicate: (this: void, value: never, index: number, obj: never[]) => value is never, args?: any) => never | undefined;
declare global {
interface Array<T> {
flat(depth: number): [];
}
}
/**
* array flat polyfill, if depth is unknow set it to "Infinity"
* @param inputArray
* @param depth
*/
declare const flat: (inputArray: [], depth?: number) => [];
export { removeString, isArray, includes, find, flat };
6 changes: 6 additions & 0 deletions dist/@types/chrisweb-utilities/utilities/datetime.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* returns the timestamp for any date or for now(), also works with browsers that dont support es5 Date.now
* @param dateString
*/
declare const getTimestamp: (dateString?: string | number) => number;
export { getTimestamp };
6 changes: 6 additions & 0 deletions dist/@types/chrisweb-utilities/utilities/helper.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* pauses your script for a given time, returns a promise that you can use to do so
* @param ms
*/
declare const sleep: (ms: number) => Promise<void>;
export { sleep };
7 changes: 7 additions & 0 deletions dist/@types/chrisweb-utilities/utilities/html.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* extracts html elements (and their content) from strings
* @param text
* @param removeTextBetweenTags
*/
declare const removeElements: (text: string, removeTextBetweenTags: boolean) => string;
export { removeElements };
6 changes: 6 additions & 0 deletions dist/@types/chrisweb-utilities/utilities/log.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* log messages
* @param args
*/
declare const log: (...args: unknown[]) => void;
export { log };
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* nodejs logging to file
* @param logObjects
* @param logObjectsLength
* @param logFontColor
*/
declare const fileLog: (logObjects: unknown, logObjectsLength: number, logFontColor: string) => void;
export { fileLog };
18 changes: 18 additions & 0 deletions dist/@types/chrisweb-utilities/utilities/log/adapters/html.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* html log
* create a div an insert the messages in div
* can be usefull on mobile if no other console is available
* @param logObjects
* @param logObjectsLength
* @param logFontColor
* @param logBackgroundColor
*/
declare const htmlLog: (logObjects: string[], logObjectsLength: number, logFontColor: string, logBackgroundColor: string) => void;
/**
* extracts html elements (and their content) from strings
* @param rawText
* @param extendedEscape
* @param myEscapeList
*/
declare const safeUnescape: (rawText: string, extendedEscape: boolean, myEscapeList: string[]) => string;
export { htmlLog, safeUnescape };
9 changes: 9 additions & 0 deletions dist/@types/chrisweb-utilities/utilities/platform.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* does the script run on the server
*/
declare const isServer: () => boolean;
/**
* does the script run in a client
*/
declare const isClient: () => boolean;
export { isServer, isClient };
7 changes: 7 additions & 0 deletions dist/@types/chrisweb-utilities/utilities/random.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* returns a random integer that lies between min (included) and max (included)
* @param min
* @param max
*/
declare const randomInteger: (min?: number, max?: number) => number;
export { randomInteger };
33 changes: 33 additions & 0 deletions dist/@types/chrisweb-utilities/utilities/string.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* filters a string
* removes everything that is a not an alpha or numeric character, plus
* the characters if any got specified as second argument
* @param inputString
* @param specialCharacters
*/
declare const filterAlphaNumericPlus: (inputString: string, specialCharacters: string) => string | boolean;
/**
* capitalise first letter of a string
* @param inputString
*/
declare const capitaliseFirstLetter: (inputString: string) => string;
/**
* does a string contain another string
* @param inputString
* @param contains
*/
declare const stringContains: (inputString: string, contains: string) => boolean;
/**
* get the index of a substring in a string with optional nth time it occurs
* @param inputString
* @param substring
* @param nthTime
*/
declare const getSubstringIndex: (inputString: string, substring: string, nthTime: number) => number;
/**
* replace the placeholder(s) with some value
* @param input
* @param replacements
*/
declare const replacePlaceholders: (input: string, replacements: string) => string;
export { filterAlphaNumericPlus, capitaliseFirstLetter, stringContains, getSubstringIndex, replacePlaceholders };
11 changes: 11 additions & 0 deletions dist/@types/chrisweb-utilities/utilities/uri.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* decode uri
* @param inputString
*/
declare const decodeUri: (inputString: string) => string;
/**
* encode uri
* @param inputString
*/
declare const encodeUri: (inputString: string) => string;
export { decodeUri, encodeUri };
21 changes: 21 additions & 0 deletions dist/@types/chrisweb-utilities/utilities/url.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* get url parameters
* @param query
*/
declare const getUrlParameters: (query?: string) => {
[s: string]: string;
};
/**
* URL utility to get a parameter by name from an URL
* @param name
* @param url
*/
declare const getUrlParameterByName: (name: string, url: string) => string;
/**
* URL utility to replace a given parameter
* @param url
* @param paramName
* @param paramValue
*/
declare const replaceUrlParameter: (url: string, paramName: string, paramValue: string | number) => string;
export { getUrlParameters, getUrlParameterByName, replaceUrlParameter };
5 changes: 5 additions & 0 deletions dist/@types/chrisweb-utilities/utilities/uuid.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* returns a universally unique identifier
*/
declare const generateUUID: () => string;
export { generateUUID };
58 changes: 48 additions & 10 deletions dist/index.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.esm.js.map

Large diffs are not rendered by default.

58 changes: 48 additions & 10 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 88abcc5

Please sign in to comment.