Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
bertha-client
Advanced tools
A client library for fetching data from [Bertha](https://github.com/ft-interactive/bertha). For use in Node and the browser.
A client library for fetching data from Bertha. For use in Node and the browser.
Why use this instead of fetching Bertha URLs with fetch
or axios
?
yarn add bertha-client
or npm install bertha-client
Browser: Use Browserify or Rollup. Requires window.fetch, so make sure this is polyfilled.
Node: Just require
or import
as usual. No need to polyfill anything – the Node version of bertha-client uses node-fetch internally.
import * as bertha from 'bertha-client'; // or const bertha = require('bertha-client');
bertha.get(spreadsheetKey, ['someSheet', 'anotherSheet|object']).then((data) => {
console.log(data);
// { someSheet: [...], anotherSheet: [...] }
});
Currently there is just one method.
Fetches the sheet and returns a promise for the response data.
String (required). A valid Google spreadsheet key, or a full Google Spreadsheet URL or Bertha URL.
Array of strings (required). The names of the sheets you want to get. A sheet name may be appended with |object
to apply the "object" transformation.
// example
const sheetNames = [
'polls',
'authors',
'copy|object', // applies the "object" transformation
]
options
Plain object (optional).
republish
(default: false) – set to true
if you want Bertha to trigger a republish.The data is always returned a plain JavaScript object (not an array). The key names correspond with the sheet names.
|object
transformationIf you append a sheet name with |object
, that sheet will be transformed into a plain object (instead of an array), using the sheet's name
and value
columns as key paths and values, respectively. Any other columns are discarded.
Example spreadsheet:
name | value |
---|---|
foo | hiya |
bar | 123 |
someone.age | 50 |
someone.name.first | Bob |
someone.name.last | Hoskins |
// result of "|object" transform
{
foo: 'hiya',
bar: '123',
someone: {
age: '50',
name: {
first: 'Bob',
last: 'Hoskins',
}
},
}
Recommended approach:
yarn
.yarn run build -- --watch
– this will compile files continually from src
to dist
using Babel.yarn run ava -- --watch
to run ava continually against files in dist
.This module is automatically published to npm via CircleCI whenever the master branch contains a higher version string than the latest published version.
To publish a new version:
yarn version
(will prompt you to enter a new version)git push && git push --tags
FAQs
A client library for fetching data from [Bertha](https://github.com/ft-interactive/bertha).
We found that bertha-client 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.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.