Zotero utility code common across various codebases such as the Zotero client,
Zotero translation architecture and others.
Item utility functions require:
Zotero.Schema.init(json) with the JSON from schema.json from Zotero schema repoZotero.Date.init(json) with the JSON from resource/dateFormats.jsonresource/zoteroTypeSchemaData.js before cachedTypes.js or in Node.js running let CachedTypes = require('./cachedTypes')
CachedTypes.setTypeSchema(require('./resource/zoteroTypeSchemaData'))
Zotero.localeCompare(); a simple implementation would be let collator = new Intl.Collator(['en-US'], {
numeric: true,
sensitivity: 'base'
});
Zotero.localeCompare = (a, b) => collator.compare(a, b);
Please bundle the Zotero schema file with your repository, do not load it remotely.
To run tests:
git clone --recursive https://github.com/zotero/utilities.git
cd utilities
npm i
npm test
We use cookies
We use cookies to analyze traffic and improve your experience. You can accept or reject analytics cookies.