code
stringlengths
24
2.07M
docstring
stringlengths
25
85.3k
func_name
stringlengths
1
92
language
stringclasses
1 value
repo
stringlengths
5
64
path
stringlengths
4
172
url
stringlengths
44
218
license
stringclasses
7 values
function _getUTF8Length(sText) { var replacedText = encodeURI(sText).toString().replace(/\%[0-9a-fA-F]{2}/g, 'a'); return replacedText.length + (replacedText.length != sText ? 3 : 0); }
Get the type by string length @private @param {String} sText @param {Number} nCorrectLevel @return {Number} type
_getUTF8Length
javascript
bryanbraun/checkboxland
docs/demos/qr-code/qrcode.js
https://github.com/bryanbraun/checkboxland/blob/master/docs/demos/qr-code/qrcode.js
MIT
isValidPackageName = function(packageName) { try { return [validPackageName(packageName), null]; } catch (error) { if (error instanceof ValidationError) return [false, error]; throw error; } }
Utils that shared both server and client.
isValidPackageName
javascript
openupm/openupm
app/common/utils.js
https://github.com/openupm/openupm/blob/master/app/common/utils.js
BSD-3-Clause
isValidPackageName = function(packageName) { try { return [validPackageName(packageName), null]; } catch (error) { if (error instanceof ValidationError) return [false, error]; throw error; } }
Utils that shared both server and client.
isValidPackageName
javascript
openupm/openupm
app/common/utils.js
https://github.com/openupm/openupm/blob/master/app/common/utils.js
BSD-3-Clause
validPackageName = function(packageName) { if (!packageName) throw new ValidationError("package name should not be empty", "empty"); const maxLength = 214; if (packageName.length > maxLength) throw new ValidationError( `package name length should be less or equal to ${maxLength}, but length is ${pac...
Utils that shared both server and client.
validPackageName
javascript
openupm/openupm
app/common/utils.js
https://github.com/openupm/openupm/blob/master/app/common/utils.js
BSD-3-Clause
validPackageName = function(packageName) { if (!packageName) throw new ValidationError("package name should not be empty", "empty"); const maxLength = 214; if (packageName.length > maxLength) throw new ValidationError( `package name length should be less or equal to ${maxLength}, but length is ${pac...
Utils that shared both server and client.
validPackageName
javascript
openupm/openupm
app/common/utils.js
https://github.com/openupm/openupm/blob/master/app/common/utils.js
BSD-3-Clause
getCachedAvatarImageFilename = function(username, size) { username = username.toLowerCase(); return `${username}-${size}x${size}.png`; }
Get the cached avatar image filename @param {string} username @param {Number} size
getCachedAvatarImageFilename
javascript
openupm/openupm
app/common/utils.js
https://github.com/openupm/openupm/blob/master/app/common/utils.js
BSD-3-Clause
getCachedAvatarImageFilename = function(username, size) { username = username.toLowerCase(); return `${username}-${size}x${size}.png`; }
Get the cached avatar image filename @param {string} username @param {Number} size
getCachedAvatarImageFilename
javascript
openupm/openupm
app/common/utils.js
https://github.com/openupm/openupm/blob/master/app/common/utils.js
BSD-3-Clause
isPackageBlockedByScope = function(packageName, scope) { if (scope.startsWith("^")) return packageName.startsWith(scope.slice(1, scope.length)); else return packageName == scope; }
Return if the package name is blocked by the given block scope @param {String} packageName @param {String} scope @returns {Boolean}
isPackageBlockedByScope
javascript
openupm/openupm
app/common/utils.js
https://github.com/openupm/openupm/blob/master/app/common/utils.js
BSD-3-Clause
isPackageBlockedByScope = function(packageName, scope) { if (scope.startsWith("^")) return packageName.startsWith(scope.slice(1, scope.length)); else return packageName == scope; }
Return if the package name is blocked by the given block scope @param {String} packageName @param {String} scope @returns {Boolean}
isPackageBlockedByScope
javascript
openupm/openupm
app/common/utils.js
https://github.com/openupm/openupm/blob/master/app/common/utils.js
BSD-3-Clause
aggregateExtraData = async function() { logger.info("aggregateExtraData"); const packageNames = await loadPackageNames(); const aggData = {}; for (let packageName of packageNames) { // Verify package if (!packageExists(packageName)) { logger.error({ pkg: packageName }, "package doesn't exist"); ...
Aggregate extra data for all packages into redis.
aggregateExtraData
javascript
openupm/openupm
app/jobs/aggregatePackageExtra.js
https://github.com/openupm/openupm/blob/master/app/jobs/aggregatePackageExtra.js
BSD-3-Clause
aggregateExtraData = async function() { logger.info("aggregateExtraData"); const packageNames = await loadPackageNames(); const aggData = {}; for (let packageName of packageNames) { // Verify package if (!packageExists(packageName)) { logger.error({ pkg: packageName }, "package doesn't exist"); ...
Aggregate extra data for all packages into redis.
aggregateExtraData
javascript
openupm/openupm
app/jobs/aggregatePackageExtra.js
https://github.com/openupm/openupm/blob/master/app/jobs/aggregatePackageExtra.js
BSD-3-Clause
getInvalidTags = function ({ remoteTags, validTags, gitTagIgnore, gitTagPrefix, minVersion }) { let tags = differenceBy(remoteTags, validTags, x => x.tag); if (gitTagPrefix) { tags = tags.filter(x => x.tag.startsWith(gitTagPrefix)); } if (gitTagIgnore) { const ignoreRe = new RegExp(gitTagIgnor...
Return invalid tags. Tags have been ignored, without the given prefix, or filtered by minVersion are not considered invalid.
getInvalidTags
javascript
openupm/openupm
app/jobs/buildPackage.js
https://github.com/openupm/openupm/blob/master/app/jobs/buildPackage.js
BSD-3-Clause
getInvalidTags = function ({ remoteTags, validTags, gitTagIgnore, gitTagPrefix, minVersion }) { let tags = differenceBy(remoteTags, validTags, x => x.tag); if (gitTagPrefix) { tags = tags.filter(x => x.tag.startsWith(gitTagPrefix)); } if (gitTagIgnore) { const ignoreRe = new RegExp(gitTagIgnor...
Return invalid tags. Tags have been ignored, without the given prefix, or filtered by minVersion are not considered invalid.
getInvalidTags
javascript
openupm/openupm
app/jobs/buildPackage.js
https://github.com/openupm/openupm/blob/master/app/jobs/buildPackage.js
BSD-3-Clause
updateReleaseRecords = async function (packageName, remoteTags) { // Remove failed local releases that not listed in remoteTags let releases = await Release.fetchAll(packageName); for (const rel of releases) { if (rel.state == ReleaseState.Failed) { // Remove failed but disappeared release. It happens w...
Return invalid tags. Tags have been ignored, without the given prefix, or filtered by minVersion are not considered invalid.
updateReleaseRecords
javascript
openupm/openupm
app/jobs/buildPackage.js
https://github.com/openupm/openupm/blob/master/app/jobs/buildPackage.js
BSD-3-Clause
updateReleaseRecords = async function (packageName, remoteTags) { // Remove failed local releases that not listed in remoteTags let releases = await Release.fetchAll(packageName); for (const rel of releases) { if (rel.state == ReleaseState.Failed) { // Remove failed but disappeared release. It happens w...
Return invalid tags. Tags have been ignored, without the given prefix, or filtered by minVersion are not considered invalid.
updateReleaseRecords
javascript
openupm/openupm
app/jobs/buildPackage.js
https://github.com/openupm/openupm/blob/master/app/jobs/buildPackage.js
BSD-3-Clause
addReleaseJobs = async function (releases) { const jobConfig = config.jobs.buildRelease; const queue = getQueue(jobConfig.queue); let i = 0; for (const rel of releases) { const reason = ReleaseReason.get(rel.reason); // Skip creating release job if release already succeeded or failed with an acceptable ...
Return invalid tags. Tags have been ignored, without the given prefix, or filtered by minVersion are not considered invalid.
addReleaseJobs
javascript
openupm/openupm
app/jobs/buildPackage.js
https://github.com/openupm/openupm/blob/master/app/jobs/buildPackage.js
BSD-3-Clause
addReleaseJobs = async function (releases) { const jobConfig = config.jobs.buildRelease; const queue = getQueue(jobConfig.queue); let i = 0; for (const rel of releases) { const reason = ReleaseReason.get(rel.reason); // Skip creating release job if release already succeeded or failed with an acceptable ...
Return invalid tags. Tags have been ignored, without the given prefix, or filtered by minVersion are not considered invalid.
addReleaseJobs
javascript
openupm/openupm
app/jobs/buildPackage.js
https://github.com/openupm/openupm/blob/master/app/jobs/buildPackage.js
BSD-3-Clause
fetchBackerData = async function(force) { logger.info("fetchBackerData"); const backers = yaml.safeLoad(await readFile(backersPath, "utf8")); for (const backer of backers.items) { if (backer.githubUser) await cacheAvatarImageForGithubUser(backer.githubUser, force); } }
Fetch backer data @param {Array} packageNames @param {Boolean} force
fetchBackerData
javascript
openupm/openupm
app/jobs/fetchBackerData.js
https://github.com/openupm/openupm/blob/master/app/jobs/fetchBackerData.js
BSD-3-Clause
fetchBackerData = async function(force) { logger.info("fetchBackerData"); const backers = yaml.safeLoad(await readFile(backersPath, "utf8")); for (const backer of backers.items) { if (backer.githubUser) await cacheAvatarImageForGithubUser(backer.githubUser, force); } }
Fetch backer data @param {Array} packageNames @param {Boolean} force
fetchBackerData
javascript
openupm/openupm
app/jobs/fetchBackerData.js
https://github.com/openupm/openupm/blob/master/app/jobs/fetchBackerData.js
BSD-3-Clause
fetchExtraData = async function(packageNames, force) { logger.info("fetchExtraData"); if (!packageNames) packageNames = []; for (let packageName of packageNames) { // Verify package if (!packageExists(packageName)) { logger.error({ pkg: packageName }, "package doesn't exist"); continue; } ...
Fetch package extra data into redis for given packageNames array. @param {Array} packageNames @param {Boolean} force
fetchExtraData
javascript
openupm/openupm
app/jobs/fetchPackageExtra.js
https://github.com/openupm/openupm/blob/master/app/jobs/fetchPackageExtra.js
BSD-3-Clause
fetchExtraData = async function(packageNames, force) { logger.info("fetchExtraData"); if (!packageNames) packageNames = []; for (let packageName of packageNames) { // Verify package if (!packageExists(packageName)) { logger.error({ pkg: packageName }, "package doesn't exist"); continue; } ...
Fetch package extra data into redis for given packageNames array. @param {Array} packageNames @param {Boolean} force
fetchExtraData
javascript
openupm/openupm
app/jobs/fetchPackageExtra.js
https://github.com/openupm/openupm/blob/master/app/jobs/fetchPackageExtra.js
BSD-3-Clause
fetchPackageMeta = async function(packageName) { let resp = null; const source = CancelToken.source(); setTimeout(() => { if (resp === null) source.cancel("ECONNTIMEOUT"); }, 10000); resp = await AxiosService.create().get( urljoin("https://package.openupm.com", packageName), { headers: { Acc...
Fetch package meta json. @param {string} packageName
fetchPackageMeta
javascript
openupm/openupm
app/jobs/fetchPackageExtra.js
https://github.com/openupm/openupm/blob/master/app/jobs/fetchPackageExtra.js
BSD-3-Clause
fetchPackageMeta = async function(packageName) { let resp = null; const source = CancelToken.source(); setTimeout(() => { if (resp === null) source.cancel("ECONNTIMEOUT"); }, 10000); resp = await AxiosService.create().get( urljoin("https://package.openupm.com", packageName), { headers: { Acc...
Fetch package meta json. @param {string} packageName
fetchPackageMeta
javascript
openupm/openupm
app/jobs/fetchPackageExtra.js
https://github.com/openupm/openupm/blob/master/app/jobs/fetchPackageExtra.js
BSD-3-Clause
getLatestVersion = function(pkgMeta) { if (pkgMeta["dist-tags"] && pkgMeta["dist-tags"]["latest"]) return pkgMeta["dist-tags"]["latest"]; else if (pkgMeta.versions) return Object.keys(pkgMeta.versions).find( (key) => pkgMeta.versions[key] == "latest" ); }
Fetch package meta json. @param {string} packageName
getLatestVersion
javascript
openupm/openupm
app/jobs/fetchPackageExtra.js
https://github.com/openupm/openupm/blob/master/app/jobs/fetchPackageExtra.js
BSD-3-Clause
getLatestVersion = function(pkgMeta) { if (pkgMeta["dist-tags"] && pkgMeta["dist-tags"]["latest"]) return pkgMeta["dist-tags"]["latest"]; else if (pkgMeta.versions) return Object.keys(pkgMeta.versions).find( (key) => pkgMeta.versions[key] == "latest" ); }
Fetch package meta json. @param {string} packageName
getLatestVersion
javascript
openupm/openupm
app/jobs/fetchPackageExtra.js
https://github.com/openupm/openupm/blob/master/app/jobs/fetchPackageExtra.js
BSD-3-Clause
_fetchPackageInfo = async function(packageName) { logger.info({ pkg: packageName }, "_fetchPackageInfo"); try { const pkgMeta = await fetchPackageMeta(packageName); const version = pkgMeta["dist-tags"].latest; const versionInfo = pkgMeta.versions[version]; // Save the unity version. const unityV...
Fetch package info from the registry. @param {string} packageName
_fetchPackageInfo
javascript
openupm/openupm
app/jobs/fetchPackageExtra.js
https://github.com/openupm/openupm/blob/master/app/jobs/fetchPackageExtra.js
BSD-3-Clause
_fetchPackageInfo = async function(packageName) { logger.info({ pkg: packageName }, "_fetchPackageInfo"); try { const pkgMeta = await fetchPackageMeta(packageName); const version = pkgMeta["dist-tags"].latest; const versionInfo = pkgMeta.versions[version]; // Save the unity version. const unityV...
Fetch package info from the registry. @param {string} packageName
_fetchPackageInfo
javascript
openupm/openupm
app/jobs/fetchPackageExtra.js
https://github.com/openupm/openupm/blob/master/app/jobs/fetchPackageExtra.js
BSD-3-Clause
_fetchPackageScopes = async function(packageName) { logger.info({ pkg: packageName }, "_fetchPackageScopes"); // a list of pending {name, version} const pendingList = [{ name: packageName, version: null }]; // a list of processed {name, version} const processedList = []; // a set of package names exists on ...
Fetch package scopes for dependencies. @param {string} packageName
_fetchPackageScopes
javascript
openupm/openupm
app/jobs/fetchPackageExtra.js
https://github.com/openupm/openupm/blob/master/app/jobs/fetchPackageExtra.js
BSD-3-Clause
_fetchPackageScopes = async function(packageName) { logger.info({ pkg: packageName }, "_fetchPackageScopes"); // a list of pending {name, version} const pendingList = [{ name: packageName, version: null }]; // a list of processed {name, version} const processedList = []; // a set of package names exists on ...
Fetch package scopes for dependencies. @param {string} packageName
_fetchPackageScopes
javascript
openupm/openupm
app/jobs/fetchPackageExtra.js
https://github.com/openupm/openupm/blob/master/app/jobs/fetchPackageExtra.js
BSD-3-Clause
_fetchRepoInfo = async function(repo, packageName) { logger.info({ pkg: packageName }, "_fetchRepoInfo"); try { const headers = { Accept: "application/vnd.github.v3.json" }; const githubToken = getGithubToken(); if (githubToken) headers.authorization = `Bearer ${githubToken}`; let resp = null; c...
Fetch repository information like stars and pushed time. @param {object} repo
_fetchRepoInfo
javascript
openupm/openupm
app/jobs/fetchPackageExtra.js
https://github.com/openupm/openupm/blob/master/app/jobs/fetchPackageExtra.js
BSD-3-Clause
_fetchRepoInfo = async function(repo, packageName) { logger.info({ pkg: packageName }, "_fetchRepoInfo"); try { const headers = { Accept: "application/vnd.github.v3.json" }; const githubToken = getGithubToken(); if (githubToken) headers.authorization = `Bearer ${githubToken}`; let resp = null; c...
Fetch repository information like stars and pushed time. @param {object} repo
_fetchRepoInfo
javascript
openupm/openupm
app/jobs/fetchPackageExtra.js
https://github.com/openupm/openupm/blob/master/app/jobs/fetchPackageExtra.js
BSD-3-Clause
_cacheImage = async function(pkg, packageName, force) { logger.info({ pkg: packageName }, "_cacheImage"); try { const query = await PackageExtra.getImageQueryForPackage(packageName); if (!query) return; // check cache let imageEntry = await getImage(query); if (!force && imageEntry && imageEntr...
Cache the image url @param {object} pkg @param {string} packageName @param {Boolean} force
_cacheImage
javascript
openupm/openupm
app/jobs/fetchPackageExtra.js
https://github.com/openupm/openupm/blob/master/app/jobs/fetchPackageExtra.js
BSD-3-Clause
_cacheImage = async function(pkg, packageName, force) { logger.info({ pkg: packageName }, "_cacheImage"); try { const query = await PackageExtra.getImageQueryForPackage(packageName); if (!query) return; // check cache let imageEntry = await getImage(query); if (!force && imageEntry && imageEntr...
Cache the image url @param {object} pkg @param {string} packageName @param {Boolean} force
_cacheImage
javascript
openupm/openupm
app/jobs/fetchPackageExtra.js
https://github.com/openupm/openupm/blob/master/app/jobs/fetchPackageExtra.js
BSD-3-Clause
_cacheAvatarImage = async function(pkg, packageName, force) { logger.info({ pkg: packageName }, "_cacheAvatarImage"); if (pkg.owner) await cacheAvatarImageForGithubUser(pkg.owner, force); if (pkg.parentOwner) await cacheAvatarImageForGithubUser(pkg.parentOwner, force); if (pkg.hunter) await cacheAvatarImage...
Cache the avatar image url @param {object} pkg @param {string} packageName @param {Boolean} force
_cacheAvatarImage
javascript
openupm/openupm
app/jobs/fetchPackageExtra.js
https://github.com/openupm/openupm/blob/master/app/jobs/fetchPackageExtra.js
BSD-3-Clause
_cacheAvatarImage = async function(pkg, packageName, force) { logger.info({ pkg: packageName }, "_cacheAvatarImage"); if (pkg.owner) await cacheAvatarImageForGithubUser(pkg.owner, force); if (pkg.parentOwner) await cacheAvatarImageForGithubUser(pkg.parentOwner, force); if (pkg.hunter) await cacheAvatarImage...
Cache the avatar image url @param {object} pkg @param {string} packageName @param {Boolean} force
_cacheAvatarImage
javascript
openupm/openupm
app/jobs/fetchPackageExtra.js
https://github.com/openupm/openupm/blob/master/app/jobs/fetchPackageExtra.js
BSD-3-Clause
cacheAvatarImageForGithubUser = async function(username, force) { for (const [sizeName, entry] of Object.entries(config.packageExtra.avatar)) { logger.info( { username, width: entry.size, height: entry.size, sizeName }, "cacheAvatarImageForGithubUser" ); try { const query = await Package...
Cache the avatar image url for the GitHub user @param {string} username @param {Boolean} force
cacheAvatarImageForGithubUser
javascript
openupm/openupm
app/jobs/fetchPackageExtra.js
https://github.com/openupm/openupm/blob/master/app/jobs/fetchPackageExtra.js
BSD-3-Clause
cacheAvatarImageForGithubUser = async function(username, force) { for (const [sizeName, entry] of Object.entries(config.packageExtra.avatar)) { logger.info( { username, width: entry.size, height: entry.size, sizeName }, "cacheAvatarImageForGithubUser" ); try { const query = await Package...
Cache the avatar image url for the GitHub user @param {string} username @param {Boolean} force
cacheAvatarImageForGithubUser
javascript
openupm/openupm
app/jobs/fetchPackageExtra.js
https://github.com/openupm/openupm/blob/master/app/jobs/fetchPackageExtra.js
BSD-3-Clause
_fetchReadme = async function(pkg, packageName) { logger.info({ pkg: packageName }, "_fetchReadme"); const langs = ["en-US", "zh-CN"]; for (const lang of langs) { const readmePathPropKey = PackageExtra.getPropKeyForLang( PackageExtra.propKeys.readme, lang ); const readmePath = pkg[readmePa...
Fetch repository readme. @param {object} repo
_fetchReadme
javascript
openupm/openupm
app/jobs/fetchPackageExtra.js
https://github.com/openupm/openupm/blob/master/app/jobs/fetchPackageExtra.js
BSD-3-Clause
_fetchReadme = async function(pkg, packageName) { logger.info({ pkg: packageName }, "_fetchReadme"); const langs = ["en-US", "zh-CN"]; for (const lang of langs) { const readmePathPropKey = PackageExtra.getPropKeyForLang( PackageExtra.propKeys.readme, lang ); const readmePath = pkg[readmePa...
Fetch repository readme. @param {object} repo
_fetchReadme
javascript
openupm/openupm
app/jobs/fetchPackageExtra.js
https://github.com/openupm/openupm/blob/master/app/jobs/fetchPackageExtra.js
BSD-3-Clause
_fetchReadmeForLang = async function(pkg, packageName, lang, readmePath) { logger.info({ pkg: packageName, lang, readmePath }, "_fetchReadmeForLang"); const pushedTime = await PackageExtra.getRepoPushedTime(packageName); const readmeCacheKey = `v0:${readmePath}:${pushedTime}`; const prevReadmeCacheKey = await P...
Fetch repository readme. @param {object} repo
_fetchReadmeForLang
javascript
openupm/openupm
app/jobs/fetchPackageExtra.js
https://github.com/openupm/openupm/blob/master/app/jobs/fetchPackageExtra.js
BSD-3-Clause
_fetchReadmeForLang = async function(pkg, packageName, lang, readmePath) { logger.info({ pkg: packageName, lang, readmePath }, "_fetchReadmeForLang"); const pushedTime = await PackageExtra.getRepoPushedTime(packageName); const readmeCacheKey = `v0:${readmePath}:${pushedTime}`; const prevReadmeCacheKey = await P...
Fetch repository readme. @param {object} repo
_fetchReadmeForLang
javascript
openupm/openupm
app/jobs/fetchPackageExtra.js
https://github.com/openupm/openupm/blob/master/app/jobs/fetchPackageExtra.js
BSD-3-Clause
fetchPackageMonthlyInstallCount = async function(packageName) { let resp = null; const source = CancelToken.source(); setTimeout(() => { if (resp === null) source.cancel("ECONNTIMEOUT"); }, 10000); resp = await AxiosService.create().get( urljoin( "https://package.openupm.com/downloads/point/last...
Fetch package meta json. @param {string} packageName @returns {Number}
fetchPackageMonthlyInstallCount
javascript
openupm/openupm
app/jobs/fetchPackageExtra.js
https://github.com/openupm/openupm/blob/master/app/jobs/fetchPackageExtra.js
BSD-3-Clause
fetchPackageMonthlyInstallCount = async function(packageName) { let resp = null; const source = CancelToken.source(); setTimeout(() => { if (resp === null) source.cancel("ECONNTIMEOUT"); }, 10000); resp = await AxiosService.create().get( urljoin( "https://package.openupm.com/downloads/point/last...
Fetch package meta json. @param {string} packageName @returns {Number}
fetchPackageMonthlyInstallCount
javascript
openupm/openupm
app/jobs/fetchPackageExtra.js
https://github.com/openupm/openupm/blob/master/app/jobs/fetchPackageExtra.js
BSD-3-Clause
_fetchPackageInstallCount = async function(packageName) { logger.info({ pkg: packageName }, "_fetchPackageInstallCount"); try { const result = await fetchPackageMonthlyInstallCount(packageName); const count = result.downloads || 0; await PackageExtra.setMonthlyDownloads(packageName, count); } catch (e...
Fetch package install count. @param {string} packageName
_fetchPackageInstallCount
javascript
openupm/openupm
app/jobs/fetchPackageExtra.js
https://github.com/openupm/openupm/blob/master/app/jobs/fetchPackageExtra.js
BSD-3-Clause
_fetchPackageInstallCount = async function(packageName) { logger.info({ pkg: packageName }, "_fetchPackageInstallCount"); try { const result = await fetchPackageMonthlyInstallCount(packageName); const count = result.downloads || 0; await PackageExtra.setMonthlyDownloads(packageName, count); } catch (e...
Fetch package install count. @param {string} packageName
_fetchPackageInstallCount
javascript
openupm/openupm
app/jobs/fetchPackageExtra.js
https://github.com/openupm/openupm/blob/master/app/jobs/fetchPackageExtra.js
BSD-3-Clause
_fetchStars = async function(repo) { try { const headers = { Accept: "application/vnd.github.v3.json" }; const githubToken = getGithubToken(); if (githubToken) headers.authorization = `Bearer ${githubToken}`; let resp = null; const source = CancelToken.source(); setTimeout(() => { if (re...
Fetch repository stars. @param {string} repo
_fetchStars
javascript
openupm/openupm
app/jobs/fetchSiteInfo.js
https://github.com/openupm/openupm/blob/master/app/jobs/fetchSiteInfo.js
BSD-3-Clause
_fetchStars = async function(repo) { try { const headers = { Accept: "application/vnd.github.v3.json" }; const githubToken = getGithubToken(); if (githubToken) headers.authorization = `Bearer ${githubToken}`; let resp = null; const source = CancelToken.source(); setTimeout(() => { if (re...
Fetch repository stars. @param {string} repo
_fetchStars
javascript
openupm/openupm
app/jobs/fetchSiteInfo.js
https://github.com/openupm/openupm/blob/master/app/jobs/fetchSiteInfo.js
BSD-3-Clause
getPropKeyForLang = function(propKey, lang) { if (!lang || lang == "en-US") return propKey; else if (lang == "zh-CN") return propKey + "_zhCN"; else throw new Error("Not implemented yet"); }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
getPropKeyForLang
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
getPropKeyForLang = function(propKey, lang) { if (!lang || lang == "en-US") return propKey; else if (lang == "zh-CN") return propKey + "_zhCN"; else throw new Error("Not implemented yet"); }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
getPropKeyForLang
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
setInvalidTags = async function(packageName, tags) { const jsonText = JSON.stringify(tags, null, 0); await setValue(packageName, propKeys.invalidTags, jsonText); }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
setInvalidTags
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
setInvalidTags = async function(packageName, tags) { const jsonText = JSON.stringify(tags, null, 0); await setValue(packageName, propKeys.invalidTags, jsonText); }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
setInvalidTags
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
getInvalidTags = async function(packageName) { const jsonText = await getValue(packageName, propKeys.invalidTags); return jsonText === null ? [] : JSON.parse(jsonText); }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
getInvalidTags
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
getInvalidTags = async function(packageName) { const jsonText = await getValue(packageName, propKeys.invalidTags); return jsonText === null ? [] : JSON.parse(jsonText); }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
getInvalidTags
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
setScopes = async function(packageName, scopes) { const jsonText = JSON.stringify(scopes, null, 0); await setValue(packageName, propKeys.scopes, jsonText); }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
setScopes
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
setScopes = async function(packageName, scopes) { const jsonText = JSON.stringify(scopes, null, 0); await setValue(packageName, propKeys.scopes, jsonText); }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
setScopes
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
getScopes = async function(packageName) { const jsonText = await getValue(packageName, propKeys.scopes); return jsonText === null ? [] : JSON.parse(jsonText); }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
getScopes
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
getScopes = async function(packageName) { const jsonText = await getValue(packageName, propKeys.scopes); return jsonText === null ? [] : JSON.parse(jsonText); }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
getScopes
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
setVersion = async function(packageName, version) { await setValue(packageName, propKeys.version, version); }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
setVersion
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
setVersion = async function(packageName, version) { await setValue(packageName, propKeys.version, version); }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
setVersion
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
getVersion = async function(packageName) { const text = await getValue(packageName, propKeys.version); return text; }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
getVersion
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
getVersion = async function(packageName) { const text = await getValue(packageName, propKeys.version); return text; }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
getVersion
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
setUnityVersion = async function(packageName, unityVersion) { await setValue(packageName, propKeys.unityVersion, unityVersion); }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
setUnityVersion
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
setUnityVersion = async function(packageName, unityVersion) { await setValue(packageName, propKeys.unityVersion, unityVersion); }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
setUnityVersion
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
getUnityVersion = async function(packageName) { const text = await getValue(packageName, propKeys.unityVersion); return text; }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
getUnityVersion
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
getUnityVersion = async function(packageName) { const text = await getValue(packageName, propKeys.unityVersion); return text; }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
getUnityVersion
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
setStars = async function(packageName, stars) { await setValue(packageName, propKeys.stars, stars); }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
setStars
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
setStars = async function(packageName, stars) { await setValue(packageName, propKeys.stars, stars); }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
setStars
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
getStars = async function(packageName) { const text = await getValue(packageName, propKeys.stars); return parseInt(text); }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
getStars
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
getStars = async function(packageName) { const text = await getValue(packageName, propKeys.stars); return parseInt(text); }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
getStars
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
setParentStars = async function(packageName, stars) { await setValue(packageName, propKeys.parentStars, stars); }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
setParentStars
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
setParentStars = async function(packageName, stars) { await setValue(packageName, propKeys.parentStars, stars); }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
setParentStars
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
getParentStars = async function(packageName) { const text = await getValue(packageName, propKeys.parentStars); return parseInt(text); }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
getParentStars
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
getParentStars = async function(packageName) { const text = await getValue(packageName, propKeys.parentStars); return parseInt(text); }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
getParentStars
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
setReadme = async function(packageName, readme, lang) { const key = getPropKeyForLang(propKeys.readme, lang); await setValue(packageName, key, readme); }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
setReadme
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
setReadme = async function(packageName, readme, lang) { const key = getPropKeyForLang(propKeys.readme, lang); await setValue(packageName, key, readme); }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
setReadme
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
getReadme = async function(packageName, lang) { const key = getPropKeyForLang(propKeys.readme, lang); const text = await getValue(packageName, key); return text; }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
getReadme
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
getReadme = async function(packageName, lang) { const key = getPropKeyForLang(propKeys.readme, lang); const text = await getValue(packageName, key); return text; }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
getReadme
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
setReadmeCacheKey = async function(packageName, lang, cacheKey) { const key = getPropKeyForLang(propKeys.readmeCacheKey, lang); await setValue(packageName, key, cacheKey); }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
setReadmeCacheKey
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
setReadmeCacheKey = async function(packageName, lang, cacheKey) { const key = getPropKeyForLang(propKeys.readmeCacheKey, lang); await setValue(packageName, key, cacheKey); }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
setReadmeCacheKey
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
getReadmeCacheKey = async function(packageName, lang) { const key = getPropKeyForLang(propKeys.readmeCacheKey, lang); const text = await getValue(packageName, key); return text; }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
getReadmeCacheKey
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
getReadmeCacheKey = async function(packageName, lang) { const key = getPropKeyForLang(propKeys.readmeCacheKey, lang); const text = await getValue(packageName, key); return text; }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
getReadmeCacheKey
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
setReadmeHtml = async function(packageName, readmeHtml, lang) { const key = getPropKeyForLang(propKeys.readmeHtml, lang); await setValue(packageName, key, readmeHtml); }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
setReadmeHtml
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
setReadmeHtml = async function(packageName, readmeHtml, lang) { const key = getPropKeyForLang(propKeys.readmeHtml, lang); await setValue(packageName, key, readmeHtml); }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
setReadmeHtml
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
getReadmeHtml = async function(packageName, lang) { const key = getPropKeyForLang(propKeys.readmeHtml, lang); const text = await getValue(packageName, key); return text; }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
getReadmeHtml
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
getReadmeHtml = async function(packageName, lang) { const key = getPropKeyForLang(propKeys.readmeHtml, lang); const text = await getValue(packageName, key); return text; }
Get the property key appended with a language code except en-US. @param {String} propKey - the property key @param {String} lang - the ISO 639-1 standard language code @returns the property key for lang
getReadmeHtml
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
getImageQueryForPackage = async function(packageName) { // get the image url const pkg = await loadPackage(packageName); const imageUrl = pkg.image; if (!imageUrl) return null; const width = config.packageExtra.image.width; const height = config.packageExtra.image.height; const fit = pkg.imageFit == "cont...
Get image query data for a package, return { imageUrl, width, height, fit } @param {string} packageName
getImageQueryForPackage
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
getImageQueryForPackage = async function(packageName) { // get the image url const pkg = await loadPackage(packageName); const imageUrl = pkg.image; if (!imageUrl) return null; const width = config.packageExtra.image.width; const height = config.packageExtra.image.height; const fit = pkg.imageFit == "cont...
Get image query data for a package, return { imageUrl, width, height, fit } @param {string} packageName
getImageQueryForPackage
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
getImageQueryForGithubUser = async function(username, size) { // get the image url const imageUrl = `https://github.com/${username}.png?size=${size}`; return { imageUrl, width: size, height: size, fit: "cover" }; }
Get image query data for a GitHub user, return { imageUrl, width, height, fit } @param {string} username @param {Number} size
getImageQueryForGithubUser
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
getImageQueryForGithubUser = async function(username, size) { // get the image url const imageUrl = `https://github.com/${username}.png?size=${size}`; return { imageUrl, width: size, height: size, fit: "cover" }; }
Get image query data for a GitHub user, return { imageUrl, width, height, fit } @param {string} username @param {Number} size
getImageQueryForGithubUser
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
getCachedImageFilename = async function(packageName) { const imageQuery = await getImageQueryForPackage(packageName); if (imageQuery) { const imageData = await getImage(imageQuery); if (imageData) return imageData.filename; } return null; }
Get the cached image filename @param {string} packageName
getCachedImageFilename
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
getCachedImageFilename = async function(packageName) { const imageQuery = await getImageQueryForPackage(packageName); if (imageQuery) { const imageData = await getImage(imageQuery); if (imageData) return imageData.filename; } return null; }
Get the cached image filename @param {string} packageName
getCachedImageFilename
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
setRepoPushedTime = async function(packageName, value) { await setValue(packageName, propKeys.repoPushedTime, value); }
Get the cached image filename @param {string} packageName
setRepoPushedTime
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
setRepoPushedTime = async function(packageName, value) { await setValue(packageName, propKeys.repoPushedTime, value); }
Get the cached image filename @param {string} packageName
setRepoPushedTime
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
getRepoPushedTime = async function(packageName) { const value = await getValue(packageName, propKeys.repoPushedTime); return parseInt(value) || 0; }
Get the cached image filename @param {string} packageName
getRepoPushedTime
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
getRepoPushedTime = async function(packageName) { const value = await getValue(packageName, propKeys.repoPushedTime); return parseInt(value) || 0; }
Get the cached image filename @param {string} packageName
getRepoPushedTime
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
setRepoUpdatedTime = async function(packageName, value) { await setValue(packageName, propKeys.repoUpdatedTime, value); }
Get the cached image filename @param {string} packageName
setRepoUpdatedTime
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
setRepoUpdatedTime = async function(packageName, value) { await setValue(packageName, propKeys.repoUpdatedTime, value); }
Get the cached image filename @param {string} packageName
setRepoUpdatedTime
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
getRepoUpdatedTime = async function(packageName) { const value = await getValue(packageName, propKeys.repoUpdatedTime); return parseInt(value) || 0; }
Get the cached image filename @param {string} packageName
getRepoUpdatedTime
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
getRepoUpdatedTime = async function(packageName) { const value = await getValue(packageName, propKeys.repoUpdatedTime); return parseInt(value) || 0; }
Get the cached image filename @param {string} packageName
getRepoUpdatedTime
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause
setRepoUnavailable = async function(packageName, value) { await setValue(packageName, propKeys.repoUnavailable, value ? "1" : "0"); }
Get the cached image filename @param {string} packageName
setRepoUnavailable
javascript
openupm/openupm
app/models/packageExtra.js
https://github.com/openupm/openupm/blob/master/app/models/packageExtra.js
BSD-3-Clause