diff --git a/client/utils/formatting.js b/client/utils/formatting.js deleted file mode 100644 index f6679d5ddfa..00000000000 --- a/client/utils/formatting.js +++ /dev/null @@ -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 -}; diff --git a/client/utils/index.js b/client/utils/index.js index bad6519bdc2..6cf17822af8 100644 --- a/client/utils/index.js +++ b/client/utils/index.js @@ -1,5 +1,3 @@ -exports.descriptionRegex = / !isAFileRE.test(item)) - .filter(file => !shouldBeIgnoredRE.test(file)); -}; diff --git a/client/utils/regEx.js b/client/utils/regEx.js deleted file mode 100644 index ac434a34376..00000000000 --- a/client/utils/regEx.js +++ /dev/null @@ -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 = /^(\_|\.)/; diff --git a/client/utils/titleify.js b/client/utils/titleify.js deleted file mode 100644 index 84516d322db..00000000000 --- a/client/utils/titleify.js +++ /dev/null @@ -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; diff --git a/curriculum/package-lock.json b/curriculum/package-lock.json index 59566985700..6276cf4628d 100644 --- a/curriculum/package-lock.json +++ b/curriculum/package-lock.json @@ -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", diff --git a/curriculum/package.json b/curriculum/package.json index 199e2b13884..006f22a0e6c 100644 --- a/curriculum/package.json +++ b/curriculum/package.json @@ -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",