How to use thu-learn-lib - 1 common examples

To help you get started, we’ve selected a few thu-learn-lib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jiegec / clone-learn-tsinghua / index.js View on Github external
const fs = require('fs');
const _ = require('lodash');
const thuLearnLib = require('thu-learn-lib');
const crossFetch = require('cross-fetch');
const realIsomorphicFetch = require('real-isomorphic-fetch');
const textVersionJs = require('textversionjs');
const htmlEntities = require('html-entities').AllHtmlEntities;
const config = require('./config');
const dirHomework = config.dirHomework;
const dirNotice = config.dirNotice;
const dirFile = config.dirFile;

let helper = new thuLearnLib.Learn2018Helper();

let current = 0;
let all = 0;

function bytesToSize(bytes) {
    if (bytes === 0) return '0B';
    var k = 1024, sizes = ['B', 'K', 'M', 'G'],
        i = Math.floor(Math.log(bytes) / Math.log(k));
    if (i == 2)
        return String(Math.floor(bytes / Math.pow(k, i)).toFixed(0)) + '.0' + sizes[i];
    return String(Math.floor(bytes / Math.pow(k, i)).toFixed(0)) + sizes[i];
}

function isSameSize(document_size, stats_size) {
    if (typeof document_size == 'string') {
        if (document_size[document_size.length - 1] === 'B') {

thu-learn-lib

a JavaScript library to provide a program-friendly interface to Web Learning (2018) of Tsinghua University

MIT
Latest version published 1 month ago

Package Health Score

73 / 100
Full package analysis

Popular thu-learn-lib functions

Similar packages