Algorithm as mentioned in https://nlp.stanford.edu/IR-book/html/htmledition/single-pass-in-memory-indexing-1.html
The package linked to from here is now pure ESM. It cannot be require()
'd from CommonJS.
This means you have the following choices:
- Use ESM yourself. (preferred)
Useimport foo from 'foo'
instead ofconst foo = require('foo')
to import the package. You also need to put"type": "module"
in your package.json and more. Follow the below guide. - If the package is used in an async context, you could use
await import(…)
from CommonJS instead ofrequire(…)
. - Stay on the existing version of the package until you can move to ESM.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const a = { | |
foo: function (target) { | |
return this === target; | |
}, | |
bar: function() { | |
return (target) => this === target; | |
} | |
} | |
b = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Async Await | |
function showLoading() { | |
console.log('Loading...'); | |
} | |
function populateTable(data) { | |
console.log(`populate table with ${data}`); | |
} | |
function updatePagination(count) { | |
console.log(`Pagination: ${count}`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Set variables | |
PROJECT_NAME=$1 | |
PROJECT_NAME_LOWER=$(echo $PROJECT_NAME | tr '[:upper:]' '[:lower:]') | |
TEST_CASE=$PROJECT_NAME_LOWER$2 | |
PATH_TO_TEST_INPUTS=input | |
PATH_TO_TEST_OUTPUTS=output | |
echo "Project: $PROJECT_NAME" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var arr = [ | |
'1 Chronicles', '1 Corinthians', '1 John', '1 Kings', | |
'1 Peter', '1 Samuel', '1 Thessalonians', '1 Timothy', | |
'2 Chronicles', '2 Corinthians', '2 John', '2 Kings', | |
'2 Peter', '2 Samuel', '2 Thessalonians', '2 Timothy', | |
'3 John', 'Acts', 'Amos', 'Colossians', | |
'Daniel', | |
'Deuteronomy', 'Ecclesiastes', 'Ephesians', 'Esther', | |
'Exodus', 'Ezekiel', 'Ezra', 'Galatians', | |
'Genesis', 'Habakkuk', 'Haggai', 'Hebrews', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PrettyObjectPrinter.prototype.objectToString = function (obj, brackets, spacing, space='') { | |
if (typeof obj != "object") | |
return obj; | |
var acc = ""; | |
var commaFlag = false; | |
for (var key in obj) { | |
acc += ((commaFlag) ? ",\n" : "") + space + key + ": "; | |
acc += this.print (obj[key], brackets, spacing, space); | |
commaFlag = true; |