Skip to content

Commit

Permalink
feature/
Browse files Browse the repository at this point in the history
  • Loading branch information
ogolan-ig committed Sep 8, 2024
1 parent 3427635 commit e410955
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@intelligo.ai/object-to-schema",
"version": "2.2.11",
"version": "2.2.12",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export {
}

// const aa = {
// "companyName": "BRIGADE CAPITAL MANAGEMENT, LP",
// "companyName": "",
// "evictionId": 1836030810467466240.0,
// "bridge": null,
// "defendantNames": [
Expand Down
9 changes: 5 additions & 4 deletions src/utils/predefinedTransformations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ const toUpperCase = applyToOneOrMany<string, string>(str => str.toUpperCase());
const titleCase = applyToOneOrMany<string, string>(titleCaseTransformer)
const companyNameFormat = applyToOneOrMany<string, string>(companyNameTransformer)

function titleCaseTransformer(str: string) {
function titleCaseTransformer(str) {

if (!str) {
return str;
}

return str.trim()
.split(/\s/)
.map(word => `${word[0].toUpperCase()}${word.slice(1).toLowerCase()}`)
.join(' ')
.toLowerCase()
.split(/\s+/)
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
.join(' ');
}

const toDate = applyToOneOrMany<string, string>(str => new Date(str).toISOString());
Expand Down

0 comments on commit e410955

Please sign in to comment.