Open ricardoerl opened 4 years ago
Hey @ricardoerl, I like the idea of discussing proposals in this thread, I guess then we can create "feature requests" using the issue template that is already place, so later these can be tracked using Projects.
I was thinking on a couple ones
I found the registry of residential and mobile phone numbers, with a scrapping script pull the data and save to CSV or JSON to be used or something more simple like a regex
function isPhoneNumber(phone) {
const phoneNumberRegex = /^[267]\d{3}-\d{4}$/;
return phoneNumberRegex.test(phone);
}
Hey @leosuncin, that's a great one.
What do you think about integrating both of them?
Verifies that given Phone Number format is valid
/^[67]\d{3}-\d{4}$/
)/^[2]\d{3}-\d{4}$/
)Get phone numbers details using the information provided by SIGET (we can even use the isMobilePhoneNumber
/ isResidentialPhoneNumber
functions to have a single one for both scenarios residential and mobile)
i.e. getPhoneNumberDetails('7742-0000')
{
type: 'mobile',
numberingPlan: {
owner: 'CTE TELECOM PERSONAL, S.A. de C.V.',
from: '7740-0000',
to: '7744-9999',
qty: 50000,
resolution: 'T-22-2001',
assignmentDate: '09/01/2001' // we could even use ISO-format
}
}
Please let me know if you have any comments or suggestions and we can create a feature request
I can open a pull request to add the new to functions, but about the scrapping script I have two proposals:
Due the different scope of the new challenge would be a good idea create a new repository with the source code, then run it within a CI environment (maybe Github Actions) every month or so, to scrap the data from the SIGET website and store it in a CSV, JSON and SQLite to be consume it later on, this can be done through a web service, hubdb or Github API.
Almost the same above but using only JSON with nanosql to query the data due it works in Node.js and browser.
@leosuncin I would prefer to keep it under the same repository to take advantage of the infrastructure that is already in place. (This repository is currently using CircleCI)
My only concern is related to the way of storing/consuming these resources.
At this moment in which we haven't discussed any other feature where we would need to heavy filter/process data, I don't see the need to implement a DB. Instead, I would suggest applying some normalization (we could even use something like normalizr) and make the calculations using plain algorithms. However, if there is any reason why you think we should use a DB, I am open to discuss it.
Thank you again for your contribution, I am looking forward to your comments ✌️
I'm not sure if normalize the data could help cause the keys are a range 7740-0000-7744-9999. I believe a DB library (like NanoSQL or lowdb) would help to query the data.
I don't think the library size could be an issue thanks to bundlers like Rollup, moreover phone number libraries are commonly heavy.
The main pain point is the support for frontend and backend environment, file access in browser is not possible (at least not cross-browser) maybe split the data in JSON files by ranges and lazy loading the required files.
async function getPhoneNumberDetails(phone) {
if (phone > 77400000 && phone < 77449999) {
const data = await import('./77400000-77449999');
return data;
}
// other ranges
}
@leosuncin sounds great!
Can you please submit the feature request for both isPhoneNumber
and getPhoneNumberDetails
so we can have better tracking of them?
Before I forget it 👀
@all-contributors please add @ricardoerl for ideas
@jonathanpalma
I've put up a pull request to add @ricardoerl! :tada:
Hey, @ricardoerl I'd like to add the idea and create the PR to validate a passport:
I have thought in the following methods:
isPassport(passport, DUI) this method will have to check first if the DUI is valid and is going to use isPassportFormat
isPassportFormat(passport) this method is only going to validate though regex if the passport is valid
@leosuncin do you know if there any page, repository in which I can check the rules of a passport, or validate that a passport always has the format "A[Your DUI without the validate digit]"?
I bet there are more ideas on how to keep expanding the library. We can use this issue as initial tracker.
If you like the idea, we can discuss the proposals in the thread and I can update the list here. Then we can migrate the list to the Projects tab or even have it in the readme.