Comparing version 0.0.22 to 0.0.23
@@ -6,4 +6,6 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const Utils = require("./utils"); | ||
exports.Utils = Utils; | ||
const lo = require("lodash"); | ||
const utils = require("./utils"); | ||
// tslint:disable-next-line:variable-name | ||
exports.Utils = Object.assign({}, lo, utils); | ||
__export(require("./debug")); | ||
@@ -10,0 +12,0 @@ __export(require("./process")); |
export declare function isClass(cls: any): cls is Function; | ||
export declare function isPrototype(obj: any): boolean; | ||
export declare function getArgs(func: (...args: any[]) => any): string[]; | ||
export declare function baseClass(cls: Function): Function; |
@@ -20,2 +20,6 @@ "use strict"; | ||
exports.isClass = isClass; | ||
function isPrototype(obj) { | ||
return !!(obj && obj.constructor && obj.constructor.prototype === obj); | ||
} | ||
exports.isPrototype = isPrototype; | ||
// http://stackoverflow.com/questions/1007981/how-to-get-function-parameter-names-values-dynamically-from-javascript | ||
@@ -22,0 +26,0 @@ function getArgs(func) { |
@@ -0,30 +1,27 @@ | ||
export declare function isBase64(str: string): boolean; | ||
export declare function isUUID(str: string): boolean; | ||
export declare function isBase64(str: string): boolean; | ||
export declare function wildcardMatch(rule: string, value: string): boolean; | ||
/** | ||
* Converts string into camelCase. | ||
* Converts string to title case. | ||
* | ||
* @see http://stackoverflow.com/questions/2970525/converting-any-string-into-camel-case | ||
* @param string The string to convert. | ||
* @return Returns the snake upper cased string. | ||
*/ | ||
export declare function camelCase(str: string, firstCapital?: boolean): string; | ||
export declare function titleCase(str: string): string; | ||
/** | ||
* Converts string into snake_case. | ||
* Converts string to snake upper case. | ||
* | ||
* @see https://regex101.com/r/QeSm2I/1 | ||
* @param string The string to convert. | ||
* @return Returns the snake upper cased string. | ||
*/ | ||
export declare function snakeCase(str: string, upper?: boolean): string; | ||
export declare function snakeUpperCase(str: string): string; | ||
/** | ||
* Converts string into kebab-case. | ||
* Converts string to kebab upper case. | ||
* | ||
* @see https://regex101.com/r/mrU9L0/1 | ||
* @param string The string to convert. | ||
* @return Returns the kebab upper cased string. | ||
*/ | ||
export declare function kebapCase(str: string, upper?: boolean): string; | ||
/** | ||
* Converts string into title-case. | ||
* | ||
* @see http://stackoverflow.com/questions/196972/convert-string-to-title-case-with-javascript | ||
*/ | ||
export declare function titleCase(str: string): string; | ||
export declare function kebabUpperCase(str: string): string; | ||
export declare function indent(text: string, spaces?: string | number): string; | ||
export declare function literal(obj: any): string; | ||
export declare function parseMap(map: string, prefix?: string): Record<string, any>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const Lo = require("lodash"); | ||
const notBase64 = /[^A-Z0-9+\/=\n\r]/i; | ||
function isUUID(str) { | ||
if (!str) | ||
return false; | ||
return !!str.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i); | ||
} | ||
exports.isUUID = isUUID; | ||
// const base64 = new RegExp("^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})([=]{1,2})?$"); | ||
@@ -34,2 +29,8 @@ function isBase64(str) { | ||
exports.isBase64 = isBase64; | ||
function isUUID(str) { | ||
if (!str) | ||
return false; | ||
return !!str.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i); | ||
} | ||
exports.isUUID = isUUID; | ||
function wildcardMatch(rule, value) { | ||
@@ -40,45 +41,36 @@ return new RegExp('^' + rule.split('*').join('.*') + '$').test(value); | ||
/** | ||
* Converts string into camelCase. | ||
* Converts string to title case. | ||
* | ||
* @see http://stackoverflow.com/questions/2970525/converting-any-string-into-camel-case | ||
* @param string The string to convert. | ||
* @return Returns the snake upper cased string. | ||
*/ | ||
function camelCase(str, firstCapital = false) { | ||
return str.replace(/^([A-Z])|[\s-_](\w)/g, (match, p1, p2, offset) => { | ||
if (firstCapital && offset === 0) | ||
return p1; | ||
if (p2) | ||
return p2.toUpperCase(); | ||
return p1.toLowerCase(); | ||
}); | ||
function titleCase(str) { | ||
const val = Lo.camelCase(str); | ||
if (!val) | ||
return val; | ||
return val.substr(0, 1).toUpperCase() + val.substr(1); | ||
} | ||
exports.camelCase = camelCase; | ||
exports.titleCase = titleCase; | ||
/** | ||
* Converts string into snake_case. | ||
* Converts string to snake upper case. | ||
* | ||
* @see https://regex101.com/r/QeSm2I/1 | ||
* @param string The string to convert. | ||
* @return Returns the snake upper cased string. | ||
*/ | ||
function snakeCase(str, upper) { | ||
const val = str.replace(/(?:([a-z])([A-Z]))|(?:((?!^)[A-Z])([a-z]))/g, '$1_$3$2$4'); | ||
return upper ? val.toUpperCase() : val.toLowerCase(); | ||
function snakeUpperCase(str) { | ||
// const val = str.replace(/(?:([a-z])([A-Z]))|(?:((?!^)[A-Z])([a-z]))/g, '$1_$3$2$4'); | ||
const val = Lo.snakeCase(str); | ||
return val.toUpperCase(); | ||
} | ||
exports.snakeCase = snakeCase; | ||
exports.snakeUpperCase = snakeUpperCase; | ||
/** | ||
* Converts string into kebab-case. | ||
* Converts string to kebab upper case. | ||
* | ||
* @see https://regex101.com/r/mrU9L0/1 | ||
* @param string The string to convert. | ||
* @return Returns the kebab upper cased string. | ||
*/ | ||
function kebapCase(str, upper) { | ||
const val = str.replace(/(?:([a-z])([A-Z]))|(?:((?!^)[A-Z])([a-z]))/g, '$1-$3$2$4'); | ||
return upper ? val.toUpperCase() : val.toLowerCase(); | ||
function kebabUpperCase(str) { | ||
return Lo.kebabCase(str).toUpperCase(); | ||
} | ||
exports.kebapCase = kebapCase; | ||
/** | ||
* Converts string into title-case. | ||
* | ||
* @see http://stackoverflow.com/questions/196972/convert-string-to-title-case-with-javascript | ||
*/ | ||
function titleCase(str) { | ||
return str.replace(/\w\S*/g, txt => txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase()); | ||
} | ||
exports.titleCase = titleCase; | ||
exports.kebabUpperCase = kebabUpperCase; | ||
function indent(text, spaces) { | ||
@@ -85,0 +77,0 @@ // tslint:disable-next-line:no-parameter-reassignment |
{ | ||
"name": "exer", | ||
"version": "0.0.22", | ||
"version": "0.0.23", | ||
"description": "Utils in TypeScript, Debug, NanoTimer ...", | ||
@@ -38,2 +38,3 @@ "author": "kbajalc@gmail.com", | ||
"dependencies": { | ||
"lodash": "^4.17.11", | ||
"uuid": "^3.3.2" | ||
@@ -43,5 +44,4 @@ }, | ||
"@types/lodash": "^4.14.123", | ||
"@types/node": "^10.14.5", | ||
"@types/node": "^10.14.6", | ||
"@types/uuid": "^3.4.4", | ||
"lodash": "^4.17.11", | ||
"ts-node": "^8.1.0", | ||
@@ -51,4 +51,4 @@ "tslint": "^5.16.0", | ||
"tty": "^1.0.1", | ||
"typescript": "^3.4.4" | ||
"typescript": "^3.4.5" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
178280
8
2420
2
+ Addedlodash@^4.17.11
+ Addedlodash@4.17.21(transitive)