Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
bower-endpoint-parser
Advanced tools
Readme
Little module that helps with endpoints parsing.
Decomposes a endpoint into name
, source
and target
.
var endpointParser = require('bower-endpoint-parser');
endpointParser.decompose('jquery#~2.0.0');
// { name: '', source: 'jquery', target: '~2.0.0' }
endpointParser.decompose('backbone=backbone-amd#~1.0.0');
// { name: 'backbone', source: 'backbone-amd', target: '~1.0.0' }
endpointParser.decompose('http://twitter.github.io/bootstrap/assets/bootstrap.zip');
// { name: '', source: 'http://twitter.github.io/bootstrap/assets/bootstrap', target: '*' }
endpointParser.decompose('bootstrap=http://twitter.github.io/bootstrap/assets/bootstrap.zip');
// { name: 'bootstrap', source: 'http://twitter.github.io/bootstrap/assets/bootstrap', target: '*' }
Inverse of decompose()
.
Takes a decomposed endpoint and composes it back into a string.
var endpointParser = require('bower-endpoint-parser');
endpointParser.compose({ name: '', source: 'jquery', target: '~2.0.0' });
// jquery#~2.0.0
endpointParser.compose({ name: 'backbone', source: 'backbone-amd', target: '~1.0.0' });
// backbone=backbone-amd#~1.0.0
endpointParser.compose({ name: '', source: 'http://twitter.github.io/bootstrap/assets/bootstrap', target: '*' });
// http://twitter.github.io/bootstrap/assets/bootstrap.zip
endpointParser.compose({ name: 'bootstrap', source: 'http://twitter.github.io/bootstrap/assets/bootstrap', target: '*' });
// bootstrap=http://twitter.github.io/bootstrap/assets/bootstrap.zip
Similar to decompose()
but specially designed to be used when parsing bower.json
dependencies.
For instance, in a bower.json
like this:
{
"name": "foo",
"version": "0.1.0",
"dependencies": {
"jquery": "~1.9.1",
"backbone": "backbone-amd#~1.0.0",
"bootstrap": "http://twitter.github.io/bootstrap/assets/bootstrap"
}
}
You would call json2decomposed
like so:
endpointParser.json2decomposed('jquery', '~1.9.1');
// { name: 'jquery', source: 'jquery', target: '~1.9.1' }
endpointParser.json2decomposed('backbone', 'backbone-amd#~1.0.0');
// { name: 'backbone', source: 'backbone-amd', target: '~1.0.0' }
endpointParser.json2decomposed('bootstrap', 'http://twitter.github.io/bootstrap/assets/bootstrap');
// { name: 'bootstrap', source: 'http://twitter.github.io/bootstrap/assets/bootstrap', target: '*' }
Inverse of json2decomposed()
.
Takes a decomposed endpoint and composes it to be saved to bower.json
.
var endpointParser = require('bower-endpoint-parser');
endpointParser.decomposed2json({ name: 'jquery', source: 'jquery', target: '~2.0.0' });
// { jquery: '~2.0.0' }
endpointParser.decomposed2json({ name: 'backbone', source: 'backbone-amd', target: '~1.0.0' });
// { backbone: 'backbone-amd#~2.0.0' }
endpointParser.decomposed2json({ name: 'bootstrap', source: 'http://twitter.github.io/bootstrap/assets/bootstrap', target: '*' });
// { bootstrap: 'http://twitter.github.io/bootstrap/assets/bootstrap' }
This function throws an exception if the name
from the decomposed endpoint is empty.
Released under the MIT License.
FAQs
Little module that helps with endpoints parsing.
The npm package bower-endpoint-parser receives a total of 125,270 weekly downloads. As such, bower-endpoint-parser popularity was classified as popular.
We found that bower-endpoint-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.