
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@dzcode-io/leblad
Advanced tools
A library providing a list of Algerian administrative areas with many useful APIs.
npm install @dzcode-io/leblad --save
Returns a list of Algerian provinces (Wilayas)
Arguments
projection: string[]
(optional) Array of Wilaya Object attributes to keep.Examples
const { getWilayaList, getWilayaByZipCode } = require('@dzcode-io/leblad');
const allWilayasDetails = getWilayaList();
// if we only want the wilaya names for example:
const wilayasNames = getWilayaList(['name', 'name_ar', 'name_en']);
Returns a wilaya that includes the given zipCode.
Arguments
zipCode: number
(required) A zip codeprojection: string[]
(optional) Array of Wilaya Object attributes to keepExamples
const { getWilayaByZipCode } = require('@dzcode-io/leblad');
// To get the wilaya that includes the zip code 1000, We can use getWilayaByZipCode
// This example will return Adrar { name: "Adrar", ...}
const wilaya = getWilayaByZipCode(1000);
// We can also select only attributes that we want, For example select name and mattricule:
const wilayaAttributes = getWilayaByZipCode(1000, ['name', 'mattricule']);
Takes a wilaya code (matricule) and returns the matching wilaya
Arguments
wilayaCode: number
(required) the Wilaya's "matricule"projection: string[]
(optional) Array of Wilaya Object attributesExamples
const { getWilayaByCode } = require('@dzcode-io/leblad');
console.log(getWilayaByCode(31)); // will print the wilaya object ({name: "Oran"...})
Takes a wilaya code (matricule) and returns a list of adjacent wilayas codes
Arguments
wilayaCode: number
(required) the Wilaya's "matricule"Examples
const { getAdjacentWilayas } = require('@dzcode-io/leblad');
console.log(getAdjacentWilayas(31)); // will print [46, 22, 29, 27]
Takes a wilaya code (matricule) and returns a list of Respective Zip-Codes for that wilaya
Arguments
wilayaCode: number
(required) the Wilaya's "matricule"Examples
const { getZipCodesForWilaya } = require('@dzcode-io/leblad');
console.log(getZipCodesForWilaya(31)); //returns list of zip codes for wilaya 31
Takes a wilaya code (matricule) ans returns list of all dairats of that wilaya.
Arguments
wilayaCode: number
(required) the Wilaya's "matricule"projection: string[]
(optional) Array of Wilaya Object attributes to keepExamples
const { getDairatsForWilaya } = require('@dzcode-io/leblad');
console.log(getDairatsForWilaya(3)); //returns list of dairats for wilaya 3
Takes a phone code and returns the matching wilaya.
Arguments
phoneCode: number | string
(required) the Wilaya's "phoneCode"projection: string[]
(optional) Array of Wilaya Object attributes to keepExamples
const { getWilayaByPhoneCode } = require('@dzcode-io/leblad');
console.log(getWilayaByPhoneCode(34)); //will the wilaya object ({name: "Béjaïa"...})
console.log(getWilayaByPhoneCode('34')); //will return the same the wilaya object ({name: "Béjaïa"...})
Takes a daira name and returns the matching wilaya.
Arguments
dairaName: string
(required) the Wilaya's "dairaName" in en|fr|arprojection: string[]
(optional) Array of Wilaya Object attributes to keepExamples
const { getWilayaByDairaName } = require('@dzcode-io/leblad');
console.log(getWilayaByDairaName('OUED RHIOU')); // will print the wilaya object ({name: "Relizane"...})
Takes a daira name and returns the matching baladyiats.
Arguments
daira: string
(required) the Wilaya's "dairaName" in en|fr|arExamples
const { getBaladyiatsForDaira } = require('@dzcode-io/leblad');
console.log(getBaladyiatsForDaira('ORAN')); // will return baladyiats for daira of "Oran"
Takes a daira code and returns the matching baladyiats.
Arguments
daira: number
(required) the Wilaya's "dairaCode" in en|fr|arExamples
const { getBaladyiatsForDairaCode } = require('@dzcode-io/leblad');
console.log(getBaladyiatsForDairaCode(31)); // will return baladyiats for daira of "Oran"
Takes a wilaya code (matricule) and returns a list of phone codes for given wilaya
Arguments
wilayaCode: number
(required) the Wilaya's "matricule"Examples
const { getPhoneCodesForWilaya } = require('@dzcode-io/leblad');
console.log(getPhoneCodesForWilaya(31)); //returns list of phone codes for wilaya 31
Takes a wilaya code (matricule) and returns the first phone code from a list of phone codes for given wilaya
Arguments
wilayaCode: number
(required) the Wilaya's "matricule"Examples
const { getPhoneCodeForWilaya } = require('@dzcode-io/leblad');
console.log(getPhoneCodeForWilaya(16)); //returns first phone code for wilaya 16
Takes a wilaya code (mattricule) and returns array of Baladiyates of wilaya.
Arguments
wilayaCode: number
(required) the Wilaya's "matricule"projection: string[]
(optional) Array of Baladyia Object attributesExamples
const { getBaladyiatsForWilaya } = require('@dzcode-io/leblad');
console.log(getBaladyiatsForWilaya(31)); // will print the baladyiats list ([{ code: 3125, name: 'AIN KERMA'..},{ code: 3105,name: 'ES SENIA',}])
Takes a Baladyia name and returns wilaya in which baladyia is located.
Arguments
baladyiaName: number
(required) the Baladyia nameprojection: string[]
(optional) Array of Wilaya Object attributesExamples
const { getWilayaByBaladyiaName } = require('@dzcode-io/leblad');
console.log(getWilayaByBaladyiaName('ES SENIA')); // will print the wilaya object ({name: "Oran"...})
Takes a Baladyia name and returns daira in which baladyia is located.
Arguments
baladyiaName: number
(required) the Baladyia nameprojection: string[]
(optional) Array of Wilaya Object attributesExamples
const { getDairaByBaladyiaName } = require('@dzcode-io/leblad');
console.log(getDairaByBaladyiaName('ES SENIA')); // will print the daira object ({name: "ES SENIA"...})
Return an object or an array of object with only data (example: Wilaya, Daira, Baladiya) attribute you select in the projection
attributes array.
Arguments
data: (object|array)
(required) A data object or an array of data objects(Wilayas, Dairas, Baladiyas)projection: string[]
(optional) Array of data Object attributesExamples
const { projectObject: projectWilaya } = require('@dzcode-io/leblad').utils;
...
const wilayasNames = projectWilaya(someWilayaObject, ['name', 'name_ar', 'name_en']);
Check if a given wilaya code (matricule) is valid (i.e is an integer between 1 and 48).
Arguments
code: number
(required) Wilaya codeCheck if a given zip code is valid (i.e is an integer between 1000 and 48073).
Arguments
code: (number|string)
(required) zip codeMake sure you have:
npm install
npm run update-dataset
Simply run
npm test
Or this command for the watch mode
:
npm run test.watch
You can also run mutation tests (using Stryker-mutator)
npm run test.mutation
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!
When contributing to this repository, please first discuss the change you wish to make by opening an issue, sending an e-mail, or any other method with us before making a change.
And also, please make sure to read our guidelines for contributing.
This project is licensed under the MIT License - see the LICENSE file for details
FAQs
Algerian administrative areas package
The npm package @dzcode-io/leblad receives a total of 41 weekly downloads. As such, @dzcode-io/leblad popularity was classified as not popular.
We found that @dzcode-io/leblad demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.