@akadenia/helpers 1.2.2 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.MD +10 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/text.d.ts +6 -0
- package/dist/text.js +13 -1
- package/package.json +1 -1
package/README.MD
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
- [`TextHelpers.convertCamelToSnakeCase(data)`](#texthelpersconvertcameltosnakecasedata)
|
|
23
23
|
- [`TextHelpers.convertCamelToKebabCase(data)`](#texthelpersconvertcameltokebabcasedata)
|
|
24
24
|
- [`TextHelpers.convertKebabToCamelCase(data)`](#texthelpersconvertkebabtocamelcasedata)
|
|
25
|
+
- [`TextHelpers.generateAcronym(term)`](#texthelpersgenerateacronymterm)
|
|
25
26
|
- [`TextHelpers.isAcronym(data)`](#texthelpersisacronymdata)
|
|
26
27
|
- [`TextHelpers.acronymToKebabCase(data)`](#texthelpersacronymtokebabcasedata)
|
|
27
28
|
- [`TextHelpers.handleNullDisplay(value, defaultValue="N/A")`](#texthelpershandlenulldisplayvalue-defaultvaluena)
|
|
@@ -239,6 +240,15 @@ Arguments
|
|
|
239
240
|
|--|--|--|--|
|
|
240
241
|
|`data`|`string`|The word needed to be converted from kebab case to camel case|
|
|
241
242
|
|
|
243
|
+
## `TextHelpers.generateAcronym(term)`
|
|
244
|
+
|
|
245
|
+
Generate an acronym from a term
|
|
246
|
+
an acronym generated from the term
|
|
247
|
+
|
|
248
|
+
Arguments
|
|
249
|
+
|Name|Type|Required|Description|
|
|
250
|
+
|--|--|--|--|
|
|
251
|
+
|`term`|`string`|The term to be converted to an acronym|
|
|
242
252
|
|
|
243
253
|
## `TextHelpers.isAcronym(data)`
|
|
244
254
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { convertCamelToSnakeCase, convertSnakeToCamelCase, fileNameFromPath, formatPosition, handleNullDisplay, pluralizeOnCondition, replaceSpacesWithUnderscore, replaceUnderscoreWithSpaces, truncateText, uuidv4, enforceCharacterLimit, capitalizeText, generateIDFromWord, generateWordFromId, convertCamelToKebabCase, convertKebabToCamelCase, isAcronym, acronymToKebabCase } from "./text";
|
|
1
|
+
import { convertCamelToSnakeCase, convertSnakeToCamelCase, fileNameFromPath, formatPosition, handleNullDisplay, pluralizeOnCondition, replaceSpacesWithUnderscore, replaceUnderscoreWithSpaces, truncateText, uuidv4, enforceCharacterLimit, capitalizeText, generateIDFromWord, generateWordFromId, convertCamelToKebabCase, convertKebabToCamelCase, generateAcronym, isAcronym, acronymToKebabCase } from "./text";
|
|
2
2
|
import * as DateHelpers from "./date";
|
|
3
3
|
import * as ObjectHelpers from "./object";
|
|
4
4
|
import * as MapHelpers from "./map";
|
|
@@ -19,6 +19,7 @@ declare const TextHelpers: {
|
|
|
19
19
|
capitalizeText: typeof capitalizeText;
|
|
20
20
|
convertCamelToKebabCase: typeof convertCamelToKebabCase;
|
|
21
21
|
convertKebabToCamelCase: typeof convertKebabToCamelCase;
|
|
22
|
+
generateAcronym: typeof generateAcronym;
|
|
22
23
|
isAcronym: typeof isAcronym;
|
|
23
24
|
acronymToKebabCase: typeof acronymToKebabCase;
|
|
24
25
|
generateIDFromWord: typeof generateIDFromWord;
|
package/dist/index.js
CHANGED
|
@@ -50,6 +50,7 @@ const TextHelpers = {
|
|
|
50
50
|
capitalizeText: text_1.capitalizeText,
|
|
51
51
|
convertCamelToKebabCase: text_1.convertCamelToKebabCase,
|
|
52
52
|
convertKebabToCamelCase: text_1.convertKebabToCamelCase,
|
|
53
|
+
generateAcronym: text_1.generateAcronym,
|
|
53
54
|
isAcronym: text_1.isAcronym,
|
|
54
55
|
acronymToKebabCase: text_1.acronymToKebabCase,
|
|
55
56
|
generateIDFromWord: text_1.generateIDFromWord,
|
package/dist/text.d.ts
CHANGED
|
@@ -82,6 +82,12 @@ export declare function convertCamelToKebabCase(word: string): string;
|
|
|
82
82
|
* @returns {string} - The word returned as camel case
|
|
83
83
|
*/
|
|
84
84
|
export declare function convertKebabToCamelCase(word: string): string;
|
|
85
|
+
/**
|
|
86
|
+
* Generate acronym from text
|
|
87
|
+
* @param term term to be converted to an acronym
|
|
88
|
+
* @returns an acronym generated from the term
|
|
89
|
+
*/
|
|
90
|
+
export declare function generateAcronym(term: string): string;
|
|
85
91
|
/**
|
|
86
92
|
* Validate if a word is acronym
|
|
87
93
|
* @function
|
package/dist/text.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateWordFromId = exports.generateIDFromWord = exports.isValidEmail = exports.enforceCharacterLimit = exports.capitalizeText = exports.handleNullDisplay = exports.acronymToKebabCase = exports.isAcronym = exports.convertKebabToCamelCase = exports.convertCamelToKebabCase = exports.convertCamelToSnakeCase = exports.convertSnakeToCamelCase = exports.pluralizeOnCondition = exports.replaceUnderscoreWithSpaces = exports.replaceSpacesWithUnderscore = exports.fileNameFromPath = exports.truncateText = exports.formatPosition = exports.uuidv4 = exports.convertKeyCasing = void 0;
|
|
3
|
+
exports.generateWordFromId = exports.generateIDFromWord = exports.isValidEmail = exports.enforceCharacterLimit = exports.capitalizeText = exports.handleNullDisplay = exports.acronymToKebabCase = exports.isAcronym = exports.generateAcronym = exports.convertKebabToCamelCase = exports.convertCamelToKebabCase = exports.convertCamelToSnakeCase = exports.convertSnakeToCamelCase = exports.pluralizeOnCondition = exports.replaceUnderscoreWithSpaces = exports.replaceSpacesWithUnderscore = exports.fileNameFromPath = exports.truncateText = exports.formatPosition = exports.uuidv4 = exports.convertKeyCasing = void 0;
|
|
4
4
|
const _1 = require("./");
|
|
5
5
|
// Internal Helper Functions At The Top
|
|
6
6
|
/**
|
|
@@ -156,6 +156,18 @@ function convertKebabToCamelCase(word) {
|
|
|
156
156
|
.join("");
|
|
157
157
|
}
|
|
158
158
|
exports.convertKebabToCamelCase = convertKebabToCamelCase;
|
|
159
|
+
/**
|
|
160
|
+
* Generate acronym from text
|
|
161
|
+
* @param term term to be converted to an acronym
|
|
162
|
+
* @returns an acronym generated from the term
|
|
163
|
+
*/
|
|
164
|
+
function generateAcronym(term) {
|
|
165
|
+
return term
|
|
166
|
+
.split(" ")
|
|
167
|
+
.map((word) => word[0])
|
|
168
|
+
.join("");
|
|
169
|
+
}
|
|
170
|
+
exports.generateAcronym = generateAcronym;
|
|
159
171
|
/**
|
|
160
172
|
* Validate if a word is acronym
|
|
161
173
|
* @function
|