Skip to content

Commit

Permalink
fix: add removed deps back
Browse files Browse the repository at this point in the history
  • Loading branch information
naftis committed Oct 7, 2024
1 parent ce3c46d commit e2e59b4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,21 @@ export async function updateResourceInHearth(resource: fhir.ResourceBase) {
return res.text()
}

export const convertToMSISDN = (phone: string, countryAlpha3: string) => {
const countryCode = callingCountries[countryAlpha3.toUpperCase()].alpha2

Check failure on line 168 in src/utils/index.ts

View workflow job for this annotation

GitHub Actions / test

Cannot find name 'callingCountries'.

const phoneUtil = PhoneNumberUtil.getInstance()

Check failure on line 170 in src/utils/index.ts

View workflow job for this annotation

GitHub Actions / test

Cannot find name 'PhoneNumberUtil'.
const number = phoneUtil.parse(phone, countryCode)

return (
phoneUtil
.format(number, PhoneNumberFormat.INTERNATIONAL)

Check failure on line 175 in src/utils/index.ts

View workflow job for this annotation

GitHub Actions / test

Cannot find name 'PhoneNumberFormat'.
// libphonenumber adds spaces and dashes to phone numbers,
// which we do not want to keep for now
.replace(/[\s-]/g, '')
)
}

const csvStringify = promisify<Array<Record<string, any>>, Options>(stringify)
export async function writeJSONToCSV(
filename: string,
Expand Down
11 changes: 11 additions & 0 deletions typings/country-data.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* OpenCRVS is also distributed under the terms of the Civil Registration
* & Healthcare Disclaimer located at http://opencrvs.org/license.
*
* Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
*/
declare module 'country-data'

0 comments on commit e2e59b4

Please sign in to comment.