chore: remove unused code (#41878)
parent
9c86ed508c
commit
669844527c
|
@ -1,177 +0,0 @@
|
|||
/* eslint-disable camelcase */
|
||||
const preFormatted = {
|
||||
acid: 'ACID',
|
||||
arraybuffer: 'ArrayBuffer',
|
||||
aws: 'AWS',
|
||||
bytelength: 'byteLength',
|
||||
charat: 'charAt',
|
||||
charcodeat: 'charCodeAt',
|
||||
codepointat: 'codePointAt',
|
||||
columnnumber: 'columnNumber',
|
||||
compareexchange: 'compareExchange',
|
||||
copywithin: 'copyWithin',
|
||||
cplusplus: 'C++',
|
||||
css: 'CSS',
|
||||
css3: 'CSS3',
|
||||
defineproperties: 'defineProperties',
|
||||
defineproperty: 'defineProperty',
|
||||
deleteproperty: 'deleteProperty',
|
||||
displayname: 'displayName',
|
||||
dynamodb: 'DynamoDB',
|
||||
e: 'E',
|
||||
endswith: 'endsWith',
|
||||
epsilon: 'EPSILON',
|
||||
filename: 'fileName',
|
||||
findindex: 'findIndex',
|
||||
foreach: 'forEach',
|
||||
fromcharcode: 'fromCharCode',
|
||||
frompointcode: 'fromPointCode',
|
||||
getdate: 'getDate',
|
||||
getday: 'getDay',
|
||||
getfullyear: 'getFullYear',
|
||||
gethours: 'getHours',
|
||||
getmilliseconds: 'getMilliseconds',
|
||||
getminutes: 'getMinutes',
|
||||
getmonth: 'getMonth',
|
||||
getownpropertydescriptor: 'getOwnPropertyDescriptor',
|
||||
getownpropertydescriptors: 'getOwnPropertyDescriptors',
|
||||
getownpropertynames: 'getOwnPropertyNames',
|
||||
getownpropertysymbols: 'getOwnPropertySymbols',
|
||||
getprototypeof: 'getPrototypeOf',
|
||||
getseconds: 'getSeconds',
|
||||
gettime: 'getTime',
|
||||
getomezoneoffset: 'getTimezoneOffset',
|
||||
getutcdate: 'getUTCDate',
|
||||
getutcday: 'getUTCDay',
|
||||
getutcfullyear: 'getUTCFullYear',
|
||||
getutchours: 'getUTCHours',
|
||||
getutcmilliseconds: 'getUTCMilliseconds',
|
||||
getutcminutes: 'getUTCMinutes',
|
||||
getutcmonth: 'getUTCMonth',
|
||||
getutcseconds: 'getUTCSeconds',
|
||||
getyear: 'getYear',
|
||||
hasownproperty: 'hasOwnProperty',
|
||||
html: 'HTML',
|
||||
html5: 'HTML5',
|
||||
ide: 'IDE',
|
||||
indexof: 'indexOf',
|
||||
ignorecase: 'ignoreCase',
|
||||
io: 'IO',
|
||||
isarray: 'isArray',
|
||||
issealed: 'isSealed',
|
||||
isextensible: 'isExtensible',
|
||||
isfinite: 'isFinite',
|
||||
isfrozen: 'isFrozen',
|
||||
isgenerator: 'isGenerator',
|
||||
isinteger: 'isInteger',
|
||||
islockfree: 'isLockFree',
|
||||
isnan: 'isNaN',
|
||||
issafeinteger: 'isSafeInteger',
|
||||
isview: 'isView',
|
||||
javascript: 'JavaScript',
|
||||
jquery: 'jQuery',
|
||||
json: 'JSON',
|
||||
lastindexof: 'lastIndexOf',
|
||||
linenumber: 'lineNumber',
|
||||
ln2: 'LN2',
|
||||
ln10: 'LN10',
|
||||
localcompare: 'localCompare',
|
||||
log2e: 'LOG2E',
|
||||
log10e: 'LOG10E',
|
||||
max_safe_integer: 'MAX_SAFE_INTEGER',
|
||||
max_value: 'MAX_VALUE',
|
||||
min_safe_integer: 'MIN_SAFE_INTEGER',
|
||||
min_value: 'MIN_VALUE',
|
||||
mongodb: 'MongoDB',
|
||||
nan: 'NaN',
|
||||
negative_infinity: 'NEGATIVE_INFINITY',
|
||||
padend: 'padEnd',
|
||||
padstart: 'padStart',
|
||||
parsefloat: 'parseFloat',
|
||||
parseint: 'parseInt',
|
||||
pi: 'PI',
|
||||
positive_infinity: 'POSITIVE_INFINITY',
|
||||
preventextentions: 'preventExtensions',
|
||||
propertyisenumerable: 'propertyIsEnumerable',
|
||||
reduceright: 'reduceRight',
|
||||
regexp: 'RegExp',
|
||||
setdate: 'setDate',
|
||||
setfullyear: 'setFullYear',
|
||||
sethours: 'setHours',
|
||||
setmilliseconds: 'setMilliseconds',
|
||||
setminutes: 'setMinutes',
|
||||
setmonth: 'setMonth',
|
||||
setprototypeof: 'setPrototypeOf',
|
||||
setseconds: 'setSeconds',
|
||||
settime: 'setTime',
|
||||
setutcdate: 'setUTCDate',
|
||||
setutcfullyear: 'setUTCFullYear',
|
||||
setutchours: 'setUTCHours',
|
||||
setutcmilliseconds: 'setUTCMilliseconds',
|
||||
setutcminutes: 'setUTCMinutes',
|
||||
setutcmonth: 'setUTCMonth',
|
||||
setutcseconds: 'setUTCSeconds',
|
||||
setyear: 'setYear',
|
||||
sql: 'SQL',
|
||||
sqrt1_2: 'SQRT1_2',
|
||||
sqrt2: 'SQRT2',
|
||||
startswith: 'startsWith',
|
||||
todatestring: 'toDateString',
|
||||
toexponential: 'toExponential',
|
||||
tofixed: 'toFixed',
|
||||
toisostring: 'toISOString',
|
||||
tojson: 'toJSON',
|
||||
tolocaledatestring: 'toLocaleDateString',
|
||||
tolocalelowercase: 'toLocaleLowerCase',
|
||||
tolocalestring: 'toLocaleString',
|
||||
tolocaletimestring: 'toLocaleTimeString',
|
||||
tolocaleuppercase: 'toLocaleUpperCase',
|
||||
tolowercase: 'toLowerCase',
|
||||
toprecision: 'toPrecision',
|
||||
tosource: 'toSource',
|
||||
tostring: 'toString',
|
||||
totimestring: 'toTimeString',
|
||||
touppercase: 'toUpperCase',
|
||||
toutcstring: 'toUTCString',
|
||||
trimleft: 'trimLeft',
|
||||
trimRight: 'trimRight',
|
||||
valueof: 'valueOf',
|
||||
__definegetter__: '__defineGetter__',
|
||||
__definesetter__: '__defineSetter__',
|
||||
__lookupgetter__: '__lookupGetter__',
|
||||
__lookupsetter__: '__lookupSetter__'
|
||||
};
|
||||
|
||||
const stopWords = [
|
||||
'a',
|
||||
'am',
|
||||
'an',
|
||||
'and',
|
||||
'as',
|
||||
'at',
|
||||
'but',
|
||||
'by',
|
||||
'for',
|
||||
'from',
|
||||
'if',
|
||||
'in',
|
||||
'into',
|
||||
'it',
|
||||
"it's",
|
||||
'its',
|
||||
'no',
|
||||
'nor',
|
||||
'not',
|
||||
'of',
|
||||
'off',
|
||||
'on',
|
||||
'or',
|
||||
'the',
|
||||
'to',
|
||||
'with'
|
||||
];
|
||||
|
||||
module.exports = {
|
||||
preFormatted,
|
||||
stopWords
|
||||
};
|
|
@ -1,5 +1,3 @@
|
|||
exports.descriptionRegex = /<blockquote|<ol|<h4|<table/;
|
||||
|
||||
exports.isBrowser = function isBrowser() {
|
||||
return typeof window !== 'undefined';
|
||||
};
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
const chalk = require('chalk');
|
||||
|
||||
module.exports = function info(str, colour = 'red') {
|
||||
console.info(chalk[colour](str));
|
||||
};
|
|
@ -1,10 +0,0 @@
|
|||
const fse = require('fs-extra');
|
||||
|
||||
const { isAFileRE, shouldBeIgnoredRE } = require('./regEx.js');
|
||||
|
||||
module.exports = function readDir(dir) {
|
||||
return fse
|
||||
.readdirSync(dir)
|
||||
.filter(item => !isAFileRE.test(item))
|
||||
.filter(file => !shouldBeIgnoredRE.test(file));
|
||||
};
|
|
@ -1,6 +0,0 @@
|
|||
exports.httpsRE = /https?\:\/\//;
|
||||
exports.isAFileRE = /(\.md|\.jsx?|\.html?)$/;
|
||||
exports.isAStubRE = /This\sis\sa\sstub.+?Help\sour\scommunity\sexpand\sit/;
|
||||
exports.markdownLinkRE = /\!?\[.*?\]\(.+?\)/g;
|
||||
exports.metaTitleRE = /^---\r?\ntitle:([^\n]*)\n---$/m;
|
||||
exports.shouldBeIgnoredRE = /^(\_|\.)/;
|
|
@ -1,61 +0,0 @@
|
|||
const { preFormatted, stopWords } = require('./formatting');
|
||||
|
||||
const prototypeRE = /prototype/i;
|
||||
const prototypesRE = /prototypes/i;
|
||||
|
||||
const removeProto = x => x !== 'prototype';
|
||||
|
||||
function titleCase(word) {
|
||||
return word[0].toUpperCase() + word.slice(1);
|
||||
}
|
||||
|
||||
function prototyper(str) {
|
||||
const formatted = str
|
||||
.replace(/javascript/i, '')
|
||||
.split('-')
|
||||
.map(str => {
|
||||
if (prototypeRE.test(str)) {
|
||||
if (str.length > 9) {
|
||||
return prototyper(str.trim().split('prototype').join('-prototype-'));
|
||||
}
|
||||
return str;
|
||||
}
|
||||
return titleify(str);
|
||||
})
|
||||
.join(' ')
|
||||
.split(' ');
|
||||
const noProto = formatted.filter(removeProto).filter(x => !!x);
|
||||
if (noProto.length === 2) {
|
||||
const [first, second] = noProto;
|
||||
const secondLC = second.toLowerCase();
|
||||
const finalSecond = preFormatted[secondLC]
|
||||
? preFormatted[secondLC]
|
||||
: secondLC;
|
||||
return `${titleify(first)}.prototype.${finalSecond}`;
|
||||
}
|
||||
if (noProto.length === 1) {
|
||||
return prototyper(noProto[0].toLowerCase().split('.').join('-'));
|
||||
}
|
||||
return titleify(str, true);
|
||||
}
|
||||
|
||||
function titleify(str, triedPrototyper) {
|
||||
if (str.match(prototypeRE) && !triedPrototyper && !prototypesRE.test(str)) {
|
||||
return prototyper(str);
|
||||
}
|
||||
return str
|
||||
.toLowerCase()
|
||||
.split('-')
|
||||
.map((word, i) => {
|
||||
if (!word) {
|
||||
return '';
|
||||
}
|
||||
if (stopWords.some(x => x === word) && i !== 0) {
|
||||
return word;
|
||||
}
|
||||
return preFormatted[word] ? preFormatted[word] : titleCase(word);
|
||||
})
|
||||
.join(' ');
|
||||
}
|
||||
|
||||
module.exports = titleify;
|
|
@ -4237,17 +4237,6 @@
|
|||
"integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==",
|
||||
"dev": true
|
||||
},
|
||||
"fs-extra": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-6.0.1.tgz",
|
||||
"integrity": "sha512-GnyIkKhhzXZUWFCaJzvyDLEEgDkPfb4/TPvJCJVuS8MWZgoSsErf++QpiAlDnKFcqhRlm+tIOcencCjyJE6ZCA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"graceful-fs": "^4.1.2",
|
||||
"jsonfile": "^4.0.0",
|
||||
"universalify": "^0.1.0"
|
||||
}
|
||||
},
|
||||
"fs-mkdirp-stream": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fs-mkdirp-stream/-/fs-mkdirp-stream-1.0.0.tgz",
|
||||
|
@ -5201,15 +5190,6 @@
|
|||
"minimist": "^1.2.5"
|
||||
}
|
||||
},
|
||||
"jsonfile": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
|
||||
"integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"graceful-fs": "^4.1.6"
|
||||
}
|
||||
},
|
||||
"jsprim": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
|
||||
|
@ -8023,12 +8003,6 @@
|
|||
"unist-util-is": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"universalify": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
|
||||
"integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",
|
||||
"dev": true
|
||||
},
|
||||
"unix-crypt-td-js": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/unix-crypt-td-js/-/unix-crypt-td-js-1.1.4.tgz",
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
"chai": "4.3.4",
|
||||
"cross-env": "7.0.3",
|
||||
"css": "3.0.0",
|
||||
"fs-extra": "6.0.1",
|
||||
"gulp": "4.0.2",
|
||||
"invariant": "2.2.4",
|
||||
"joi": "13.7.0",
|
||||
|
|
Loading…
Reference in New Issue