Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
angular-dsv
Advanced tools
delimter-seperated-values
A angularjs service for reading tabular data from text files; for example tab-delimited and comma-delimited. angular-dsv combines the convenience of the d3 csv/tsv module with angular's $http service. angular-dsv is RFC4180-compliant and dependent only on angular itself.
bower install angular-dsv
or bower install Hypercubed/angular-dsv
angular-dsv.js
into your app. By default at bower_components/angular-dsv/angular-dsv.js
.hc.dsv
as a module dependency to your app.The dsv service takes a single argument and returns a new $http
-like service for handling text files of delimiter
-seperated values. dsv.tsv
and dsv.csv
are shortcuts for dsv('\t')
and dsv(',')
respectively.
The dsv.tsv
service is an example of 'delimiter'-seperated value interface for tab-delimited tables. It is service which takes two arguments: a configuration object like that expected by angular's $http, and an optional accessor function for transforming each row of the tabular data file. Like $http
dsv.tsv
returns a promise with two "$http specific methods": .success
and .error
(in addition to .then
)
dsv.tsv({method: 'GET', url: '/someUrl'}, function(d) { return {key: d.key, value: +d.value}; })
.success(function(data, status, headers, config) {
// this callback will be called asynchronously
// when the response is available
})
.error(function(data, status, headers, config) {
// called asynchronously if an error occurs
// or server returns response with an error status.
});
The data value is array of objects representing the parsed rows returned from the specified url. The first row of the returned data is used as column names; these column names become the attributes on the returned objects. For example if the http request returns:
Year Make Model Length
1997 Ford E350 2.34
2000 Mercury Cougar 2.38
The resulting JavaScript array is:
[
{"Year": "1997", "Make": "Ford", "Model": "E350", "Length": "2.34"},
{"Year": "2000", "Make": "Mercury", "Model": "Cougar", "Length": "2.38"}
]
Like $http
dsv.tsv
provides a shortcut method for HTTP GET:
dsv.tsv.get('/someUrl', accessorFunction).success(successCallback);
Similar to the dsv.tsv.get
shortcut except the returned value is an array of arrays and the header line is treated as a standard row. For example if the http request returns:
Year Make Model Length
1997 Ford E350 2.34
2000 Mercury Cougar 2.38
The resulting JavaScript array is:
[
["Year", "Make", "Model", "Length"],
["1997", "Ford", "E350", "2.34"],
["2000", "Mercury", "Cougar", "2.38"]
]
Like dsv.tsv
except for comma-seperated-values.
Install npm and bower dependencies:
npm install
bower install
npm test
Previously portions of this code were taken from mbostock's d3 csv/tsv module. Now using d3-dsv.
MIT
FAQs
delimter-seperated-values
The npm package angular-dsv receives a total of 3 weekly downloads. As such, angular-dsv popularity was classified as not popular.
We found that angular-dsv demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.