Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
@house-of-angular/typed-urls
Advanced tools
A utility package for creating typed url addresses.
npm install @house-of-angular/typed-urls --save-dev
You can create an instance of typed url with urlFactory
. Url factory will return an instance of class with url
method that allows you to create an url based on provided blueprint.
import { urlFactory } from '@house-of-angular/typed-urls';
const url = urlFactory('http://api-domain/users');
// Logs "http://api-domain/users"
console.log(url.url());
Based on provided value urlFactory
will indicate whether any params in the url are expected. It will throw an error in
case they are.
Example:
import { urlFactory } from '@house-of-angular/typed-urls';
const url = urlFactory('http://api-domain/users/:id');
// Logs "http://api-domain/users/1234"
console.log(url.url({ id: '1234' }));
const multipleParamsUrl = urlFactory('http://api-domain/users/:id/achievements/:achievementId');
// Logs "http://api-domain/users/1234/achievements/533"
console.log(multipleParamsUrl.url({ id: '1234', achievementId: '533' }));
Url factory automatically retrieves expected query parameters from the url. The value of the parameter should be set to its type.
List of Available Types:
Example:
import { urlFactory } from '@house-of-angular/typed-urls';
const url = urlFactory('http://api-domain/products?limit=number&sorting=string');
// Logs "http://api-domain/products?limit=5&sorting=asc"
console.log(url.url({ limit: 5, sorting: 'asc' }));
All query parameters are optional by default. To mark param as required add an exclamation mark after parameter type.
Example:
const url = urlFactory('http://api-domain/products?limit=number&sorting=string!')
In the example above:
limit
parameter is optionalsorting
parameter is requiredLibrary allows combination of both parameter types in single url.
Example:
import { urlFactory } from '@house-of-angular/typed-urls';
const url = urlFactory('http://api-domain/users/:id/achievements?limit=number&sorting=string');
// Logs "http://api-domain/users/1/achievements?limit=5&sorting=asc"
console.log(url.url({ id: 1 }, { limit: 5, sorting: 'asc' }));
FAQs
Package for creating typed url addresses.
We found that @house-of-angular/typed-urls demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.