repo
stringlengths
5
106
file_url
stringlengths
78
301
file_path
stringlengths
4
211
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:56:49
2026-01-05 02:23:25
truncated
bool
2 classes
soruly/trace.moe-api
https://github.com/soruly/trace.moe-api/blob/d86ac21aa9f2185537e25955e2132837970a4cef/script/check-user.js
script/check-user.js
import "../env.js"; import sql from "../sql.js"; const rows = await sql` SELECT * FROM webhook WHERE source = 'PATREON' LIMIT 1 `; for (const row of rows) { const { data: { attributes: { patron_status, email, full_name }, }, included, } = row.json; if (!email) { cont...
javascript
MIT
d86ac21aa9f2185537e25955e2132837970a4cef
2026-01-05T03:37:17.940022Z
false
soruly/trace.moe-api
https://github.com/soruly/trace.moe-api/blob/d86ac21aa9f2185537e25955e2132837970a4cef/script/anilist.js
script/anilist.js
import fs from "node:fs/promises"; import path from "node:path"; import "../env.js"; import sql from "../sql.js"; const q = {}; q.query = await fs.readFile(path.join(import.meta.dirname, "anilist.graphql"), "utf8"); const anilistChinese = await fetch( "https://raw.githubusercontent.com/soruly/anilist-chinese/refs/h...
javascript
MIT
d86ac21aa9f2185537e25955e2132837970a4cef
2026-01-05T03:37:17.940022Z
false
soruly/trace.moe-api
https://github.com/soruly/trace.moe-api/blob/d86ac21aa9f2185537e25955e2132837970a4cef/script/cleanup.js
script/cleanup.js
import path from "node:path"; import fs from "node:fs/promises"; import { MilvusClient } from "@zilliz/milvus2-sdk-node"; import "../env.js"; import sql from "../sql.js"; const { VIDEO_PATH, MILVUS_ADDR, MILVUS_TOKEN } = process.env; console.log("Removing deleted video files from database"); const milvus = new Milvu...
javascript
MIT
d86ac21aa9f2185537e25955e2132837970a4cef
2026-01-05T03:37:17.940022Z
false
VladimirMikulic/sms-gaming
https://github.com/VladimirMikulic/sms-gaming/blob/31a7c27aa8a09f60bc70693ea8606167274b3781/lib/commands.js
lib/commands.js
const MPGamesManager = require('./core/MPGamesManager'); const ProcessManager = require('./core/ProcessManager'); const { listOfGames, singlePlayerWelcomeMsg, multiPlayerWelcomeMsg } = require('./messages'); /** * Activates conversation mode * @param {("single-player" | "multi-player")} mode mode to activate ...
javascript
MIT
31a7c27aa8a09f60bc70693ea8606167274b3781
2026-01-05T03:37:26.627104Z
false
VladimirMikulic/sms-gaming
https://github.com/VladimirMikulic/sms-gaming/blob/31a7c27aa8a09f60bc70693ea8606167274b3781/lib/messages.js
lib/messages.js
const GameFactory = require('./games/GameFactory'); const listOfGames = (() => { let message = ''; const games = GameFactory.getGames(); games.forEach((Game, i) => { message += `${i + 1} - ${Game.name}\n`; }); return message; })(); const invalidInputMsg = 'โš ๏ธ Your message does not correspond to any ...
javascript
MIT
31a7c27aa8a09f60bc70693ea8606167274b3781
2026-01-05T03:37:26.627104Z
false
VladimirMikulic/sms-gaming
https://github.com/VladimirMikulic/sms-gaming/blob/31a7c27aa8a09f60bc70693ea8606167274b3781/lib/app.js
lib/app.js
require('dotenv').config(); const multiPlayerModeHandler = require('./mode-controllers/multiplayer'); const singlePlayerModeHandler = require('./mode-controllers/singleplayer'); const express = require('express'); const session = require('express-session'); const { singlePlayerWelcomeMsg, serverErrorMsg } = require(...
javascript
MIT
31a7c27aa8a09f60bc70693ea8606167274b3781
2026-01-05T03:37:26.627104Z
false
VladimirMikulic/sms-gaming
https://github.com/VladimirMikulic/sms-gaming/blob/31a7c27aa8a09f60bc70693ea8606167274b3781/lib/utils.js
lib/utils.js
const twilio = require('twilio'); const { TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN } = process.env; const client = twilio(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN); const MessagingResponse = twilio.twiml.MessagingResponse; const sendMessage = res => message => { const twiml = new MessagingResponse(); if (message instan...
javascript
MIT
31a7c27aa8a09f60bc70693ea8606167274b3781
2026-01-05T03:37:26.627104Z
false
VladimirMikulic/sms-gaming
https://github.com/VladimirMikulic/sms-gaming/blob/31a7c27aa8a09f60bc70693ea8606167274b3781/lib/games/Hangman.js
lib/games/Hangman.js
const superb = require('superb'); const randomWords = require('random-words'); const { isAlpha } = require('validator').default; class Hangman { static name = 'Hangman'; constructor(gameId) { this.state = 'play'; this.gameId = gameId; this.word = randomWords().toUpperCase(); this.numOfFailedAttemp...
javascript
MIT
31a7c27aa8a09f60bc70693ea8606167274b3781
2026-01-05T03:37:26.627104Z
false
VladimirMikulic/sms-gaming
https://github.com/VladimirMikulic/sms-gaming/blob/31a7c27aa8a09f60bc70693ea8606167274b3781/lib/games/JumbledWord.js
lib/games/JumbledWord.js
const superb = require('superb'); const randomWords = require('random-words'); const { shuffleArray } = require('./utils'); class JumbledWord { static name = 'Jumbled Word'; constructor(gameId) { this.state = 'play'; this.gameId = gameId; this.originalWord = randomWords(); this.shuffledWord = this...
javascript
MIT
31a7c27aa8a09f60bc70693ea8606167274b3781
2026-01-05T03:37:26.627104Z
false
VladimirMikulic/sms-gaming
https://github.com/VladimirMikulic/sms-gaming/blob/31a7c27aa8a09f60bc70693ea8606167274b3781/lib/games/GuessNumber.js
lib/games/GuessNumber.js
class GuessNumber { static name = 'Guess a Number'; constructor(gameId) { this.state = 'play'; this.gameId = gameId; this.maxNumOfAttemts = 5; this.numOfFailedAttempts = 0; this.randomNumber = Math.ceil(Math.random() * 100); } get welcomeMessage() { const message = "In this game,...
javascript
MIT
31a7c27aa8a09f60bc70693ea8606167274b3781
2026-01-05T03:37:26.627104Z
false
VladimirMikulic/sms-gaming
https://github.com/VladimirMikulic/sms-gaming/blob/31a7c27aa8a09f60bc70693ea8606167274b3781/lib/games/GameFactory.js
lib/games/GameFactory.js
const { randomUUID } = require('crypto'); class GameFactory { static #games = [ require('./Hangman'), require('./GuessNumber'), require('./EmojiTranslate'), require('./JumbledWord'), require('./Trivia') ]; static createGame(index) { const gameId = randomUUID(); const Game = GameFacto...
javascript
MIT
31a7c27aa8a09f60bc70693ea8606167274b3781
2026-01-05T03:37:26.627104Z
false
VladimirMikulic/sms-gaming
https://github.com/VladimirMikulic/sms-gaming/blob/31a7c27aa8a09f60bc70693ea8606167274b3781/lib/games/EmojiTranslate.js
lib/games/EmojiTranslate.js
const superb = require('superb'); const txtgen = require('txtgen/dist/cjs/txtgen'); const emojiTranslate = require('moji-translate'); class EmojiTranslate { static name = 'Emoji Translate'; constructor(gameId) { this.state = 'play'; this.gameId = gameId; this.sentence = txtgen.sentence(); this.emo...
javascript
MIT
31a7c27aa8a09f60bc70693ea8606167274b3781
2026-01-05T03:37:26.627104Z
false
VladimirMikulic/sms-gaming
https://github.com/VladimirMikulic/sms-gaming/blob/31a7c27aa8a09f60bc70693ea8606167274b3781/lib/games/Trivia.js
lib/games/Trivia.js
const superb = require('superb'); const { shuffleArray, alphabet } = require('./utils'); const { decode } = require('html-entities'); class Trivia { static name = 'Trivia'; constructor(gameId) { this.state = 'play'; this.gameId = gameId; this.quizStarted = false; this.currentQuestionIndex = 0; ...
javascript
MIT
31a7c27aa8a09f60bc70693ea8606167274b3781
2026-01-05T03:37:26.627104Z
false
VladimirMikulic/sms-gaming
https://github.com/VladimirMikulic/sms-gaming/blob/31a7c27aa8a09f60bc70693ea8606167274b3781/lib/games/utils.js
lib/games/utils.js
exports.shuffleArray = arr => { const shuffledArray = [...arr]; for (let i = 0; i < shuffledArray.length; i++) { const randomNum = Math.floor(Math.random() * shuffledArray.length); const item = shuffledArray[i]; shuffledArray[i] = shuffledArray[randomNum]; shuffledArray[randomNum] = item; } re...
javascript
MIT
31a7c27aa8a09f60bc70693ea8606167274b3781
2026-01-05T03:37:26.627104Z
false
VladimirMikulic/sms-gaming
https://github.com/VladimirMikulic/sms-gaming/blob/31a7c27aa8a09f60bc70693ea8606167274b3781/lib/mode-controllers/singleplayer.js
lib/mode-controllers/singleplayer.js
const { invalidInputMsg } = require('../messages'); const commands = require('../commands').singlePlayerCommands; const GameFactory = require('../games/GameFactory'); const SPGamesManager = require('../core/SPGamesManager'); module.exports = async (req, res) => { const { Body: userMsg } = req.body; if (req.user....
javascript
MIT
31a7c27aa8a09f60bc70693ea8606167274b3781
2026-01-05T03:37:26.627104Z
false
VladimirMikulic/sms-gaming
https://github.com/VladimirMikulic/sms-gaming/blob/31a7c27aa8a09f60bc70693ea8606167274b3781/lib/mode-controllers/multiplayer.js
lib/mode-controllers/multiplayer.js
const { invalidInputMsg } = require('../messages'); const commands = require('../commands').multiPlayerCommands; const MPGamesManager = require('../core/MPGamesManager'); const ProcessManager = require('../core/ProcessManager'); module.exports = async (req, res) => { const { Body: userMsg } = req.body; if (userM...
javascript
MIT
31a7c27aa8a09f60bc70693ea8606167274b3781
2026-01-05T03:37:26.627104Z
false
VladimirMikulic/sms-gaming
https://github.com/VladimirMikulic/sms-gaming/blob/31a7c27aa8a09f60bc70693ea8606167274b3781/lib/core/ProcessManager.js
lib/core/ProcessManager.js
const { randomUUID } = require('crypto'); const JoinGame = require('../processes/JoinGame'); const GameCreation = require('../processes/GameCreation'); const UsernameCreation = require('../processes/UsernameCreation'); class ProcessManager { static #processes = []; static async createProcess(processType, req) { ...
javascript
MIT
31a7c27aa8a09f60bc70693ea8606167274b3781
2026-01-05T03:37:26.627104Z
false
VladimirMikulic/sms-gaming
https://github.com/VladimirMikulic/sms-gaming/blob/31a7c27aa8a09f60bc70693ea8606167274b3781/lib/core/MPGamesManager.js
lib/core/MPGamesManager.js
const { randomUUID } = require('crypto'); /** * MultiPlayer Games Manager */ class MPGamesManager { static #games = []; static async createGame(gameDetails, req) { const game = { id: randomUUID(), name: gameDetails.name, numOfPlayers: gameDetails.numOfPlayers, players: [gameDetails.c...
javascript
MIT
31a7c27aa8a09f60bc70693ea8606167274b3781
2026-01-05T03:37:26.627104Z
false
VladimirMikulic/sms-gaming
https://github.com/VladimirMikulic/sms-gaming/blob/31a7c27aa8a09f60bc70693ea8606167274b3781/lib/core/SPGamesManager.js
lib/core/SPGamesManager.js
/** * SinglePlayer Games Manager */ class SPGamesManager { static #games = []; static async createGame(gameSession, req) { const { gameId } = gameSession; req.user.gameSessId = gameId; SPGamesManager.#games.push(gameSession); await req.saveUserSession(req.user); return gameSession; } s...
javascript
MIT
31a7c27aa8a09f60bc70693ea8606167274b3781
2026-01-05T03:37:26.627104Z
false
VladimirMikulic/sms-gaming
https://github.com/VladimirMikulic/sms-gaming/blob/31a7c27aa8a09f60bc70693ea8606167274b3781/lib/processes/Process.js
lib/processes/Process.js
class Process { constructor(pid) { this.pid = pid; } get welcomeMessage() { return this.nextQuestion().question; } nextQuestion() { return this.questions.find(q => q.answer === null) || {}; } handleUserResponse(message) { const question = this.nextQuestion(); const isAnswerValid = ...
javascript
MIT
31a7c27aa8a09f60bc70693ea8606167274b3781
2026-01-05T03:37:26.627104Z
false
VladimirMikulic/sms-gaming
https://github.com/VladimirMikulic/sms-gaming/blob/31a7c27aa8a09f60bc70693ea8606167274b3781/lib/processes/UsernameCreation.js
lib/processes/UsernameCreation.js
const { multiPlayerWelcomeMsg } = require('../messages'); const { isAlphanumeric, isLength } = require('validator').default; const Process = require('./Process'); class UsernameCreation extends Process { constructor(pid) { super(pid); this.questions = [ { question: 'โšก Please enter your usernam...
javascript
MIT
31a7c27aa8a09f60bc70693ea8606167274b3781
2026-01-05T03:37:26.627104Z
false
VladimirMikulic/sms-gaming
https://github.com/VladimirMikulic/sms-gaming/blob/31a7c27aa8a09f60bc70693ea8606167274b3781/lib/processes/JoinGame.js
lib/processes/JoinGame.js
const Process = require('./Process'); const MPGamesManager = require('../core/MPGamesManager'); class JoinGame extends Process { constructor(pid) { super(pid); this.questions = [ { question: '๐ŸŽฎ Please enter game session ID:', answer: null, validateAnswer: this.validateGameSessi...
javascript
MIT
31a7c27aa8a09f60bc70693ea8606167274b3781
2026-01-05T03:37:26.627104Z
false
VladimirMikulic/sms-gaming
https://github.com/VladimirMikulic/sms-gaming/blob/31a7c27aa8a09f60bc70693ea8606167274b3781/lib/processes/GameCreation.js
lib/processes/GameCreation.js
const Process = require('./Process'); const MPGamesManager = require('../core/MPGamesManager'); const { isLength } = require('validator').default; class GameCreation extends Process { constructor(pid) { super(pid); this.questions = [ { question: '๐ŸŽฎ Name of the Game:', answer: null, ...
javascript
MIT
31a7c27aa8a09f60bc70693ea8606167274b3781
2026-01-05T03:37:26.627104Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/index.js
index.js
module.exports.I = require('./combinators/I') module.exports.K = require('./combinators/K') module.exports.S = require('./combinators/S') module.exports.W = require('./combinators/W') module.exports.error = require('./console/error') module.exports.log = require('./console/log') module.exports.logF = require('./console...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/doczrc.js
doczrc.js
export default { title: 'MojiScript', // dest: 'docs', base: '/', codeSandbox: false, hashRouter: true, htmlContext: { head: { raw: ` <style> .scrollbar-container { max-height: unset!important; } </style> `, links: [ { rel: 'stylesheet', ...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/string/template.js
string/template.js
/* * code adapted from: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals */ const template = (strings, ...keys) => (...values) => { const dict = values[0] || {} const result = [ strings[0] ] keys.forEach((key, i) => { const value = Number.isInteger(key) ? values[key] : dic...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/string/append.js
string/append.js
const signature = require('../_internal/debug/signature') // append :: String -> String -> String const append = post => pre => `${pre}${post}` module.exports = append // Experimental debug code /* istanbul ignore next */ if (process.env.MOJI_DEBUG === 'true') { module.exports = signature('append :: String -> Stri...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/string/prepend.js
string/prepend.js
const signature = require('../_internal/debug/signature') // prepend :: String -> String -> String const prepend = pre => post => `${pre}${post}` module.exports = prepend // Experimental debug code /* istanbul ignore next */ if (process.env.MOJI_DEBUG === 'true') { module.exports = signature('prepend :: String -> ...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/string/replace.js
string/replace.js
const signature = require('../_internal/debug/signature') const escapeRegExp = require('../_internal/escapeRegExp') // replace :: String -> String -> String -> String const replace = pattern => replacement => string => string.replace(new RegExp(escapeRegExp(pattern), 'g'), replacement) module.exports = replace // ...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/string/__tests__/template.test.js
string/__tests__/template.test.js
const $ = require('../template') describe('string/template', () => { const list = [ { foo: 'World' }, { foo: 'Sunshine' } ] test('no args template', () => { const expected = '!' const func = $`${0}!` const actual = func() expect(actual).toBe(expected) }) test('simple template', () =...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/string/__tests__/prepend.test.js
string/__tests__/prepend.test.js
const prepend = require('../prepend') describe('string/prepend', () => { test('prepend strings', () => { const expected = 'AB' const actual = prepend('A')('B') expect(actual).toBe(expected) }) test('prepend null as empty string', () => { const expected = 'B' const actual = prepend('')('B') ...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/string/__tests__/replace.test.js
string/__tests__/replace.test.js
const replace = require('../replace') describe('string/replace', () => { test('replaces string', () => { const expected = 'A_C' const actual = replace('B')('_')('ABC') expect(actual).toBe(expected) }) test('replaces multiple', () => { const expected = 'A_C A_C A_C' const actual = replace('B'...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/string/__tests__/append.test.js
string/__tests__/append.test.js
const append = require('../append') describe('string/append', () => { test('appends strings', () => { const expected = 'AB' const actual = append('B')('A') expect(actual).toBe(expected) }) test('appends null as empty string', () => { const expected = 'A' const actual = append('')('A') ex...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/type/_allTypes.js
type/_allTypes.js
module.exports = { typeJust: Symbol('mojiscript/type/Just'), typeMaybe: Symbol('mojiscript/type/Maybe'), typeNothing: Symbol('mojiscript/type/Nothing'), typeEither: Symbol('mojiscript/type/Either'), typeRight: Symbol('mojiscript/type/Right'), typeLeft: Symbol('mojiscript/type/Left') }
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/type/Nothing.js
type/Nothing.js
const { typeNothing } = require('./_allTypes') const Just = require('./Just') function getOrElse(defaultValue) { return defaultValue } function getValue(errCallback) { return errCallback() } const Nothing = Object.freeze(Object.create( { '@@type': typeNothing, toString: () => '', inspect: () => 'No...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/type/Either.js
type/Either.js
const signature = require('../_internal/debug/signature') const is = require('./is') const Left = require('./Left') const Right = require('./Right') const { typeEither } = require('./_allTypes') const isRight = is(Right) // fromFalsy :: Any -> Either const fromFalsy = value => value ? Right(value) : Left(value) // f...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/type/is.js
type/is.js
const signature = require('../_internal/debug/signature') const { typeJust, typeMaybe, typeNothing, typeEither, typeLeft, typeRight } = require('./_allTypes') const testFunction = ctor => ctor === Function const isFunction = value => typeof value === 'function' const testSymbol = ctor => typeof ctor === 'function' ...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/type/Just.js
type/Just.js
const is = require('./is') const { typeJust } = require('./_allTypes') const isFunction = is(Function) // Just :: Any -> Just const Just = value => Object.create( prototype, // eslint-disable-line no-use-before-define { value: { value, writable: false, enumerable: true, configurable: f...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/type/Left.js
type/Left.js
const is = require('./is') const { typeLeft } = require('./_allTypes') const isError = is(Error) const isFunction = is(Function) // Left :: Any -> Left const Left = value => Object.create( prototype, // eslint-disable-line no-use-before-define { value: { value, writable: false, enumerable: t...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/type/Maybe.js
type/Maybe.js
const signature = require('../_internal/debug/signature') const is = require('./is') const Just = require('./Just') const Nothing = require('./Nothing') const { typeMaybe } = require('./_allTypes') const isJust = is(Just) // fromFalsy :: Any -> Maybe const fromFalsy = value => value ? Just(value) : Nothing // fromMa...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/type/Right.js
type/Right.js
const is = require('./is') const { typeRight } = require('./_allTypes') const isError = is(Error) const isFunction = is(Function) // Right :: Any -> Right const Right = value => Object.create( prototype, // eslint-disable-line no-use-before-define { value: { value, writable: false, enumerabl...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/type/__tests__/Nothing.test.js
type/__tests__/Nothing.test.js
const Nothing = require('../Nothing') describe('type/Nothing', () => { test('is immutable', () => { expect.assertions(1) const expected = null const nothing = Nothing nothing.value = 666 const actual = nothing.value expect(actual).toBe(expected) }) test('map', () => { expect.assertio...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/type/__tests__/Just.test.js
type/__tests__/Just.test.js
const Just = require('../Just') const Nothing = require('../Nothing') describe('type/Just', () => { test('value prop is set to value', () => { expect.assertions(1) const expected = 888 const actual = Just(888).value expect(actual).toBe(expected) }) test('is immutable', () => { expect.asserti...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/type/__tests__/Maybe.test.js
type/__tests__/Maybe.test.js
const is = require('../is') const Just = require('../Just') const { fromFalsy, fromNullable, fromMaybe, unlift } = require('../Maybe') const Nothing = require('../Nothing') const toStringMaybe = maybe => maybe.map(value => value.toUpperCase()) describe('Maybe', () => { describe('fromFalsy', () => { test('null...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/type/__tests__/is.test.js
type/__tests__/is.test.js
const is = require('../is') const Nothing = require('../Nothing') const Just = require('../Just') const Maybe = require('../Maybe') const Either = require('../Either') const Right = require('../Right') const Left = require('../Left') describe('types/is', () => { describe('Boolean', () => { const isBoolean = is(B...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/type/__tests__/Left.test.js
type/__tests__/Left.test.js
const Left = require('../Left') const Right = require('../Right') const double = x => x * 2 const eitherDouble = x => x === Infinity ? Left('Cannot double Infinity') : Right(double(x)) describe('type/Left', () => { test('value prop is set to value', () => { expect.assertions(1) const expected = 888 cons...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/type/__tests__/Right.test.js
type/__tests__/Right.test.js
const Right = require('../Right') const Left = require('../Left') const double = x => x * 2 const eitherDouble = x => x === Infinity ? Left('Cannot double Infinity') : Right(double(x)) describe('type/Right', () => { test('value prop is set to value', () => { expect.assertions(1) const expected = 888 con...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/type/__tests__/Either.test.js
type/__tests__/Either.test.js
const is = require('../is') const Right = require('../Right') const Left = require('../Left') const Either = require('../Either') const { fromFalsy, fromNullable, fromEither } = Either describe('Either', () => { describe('fromFalsy', () => { test('null is Left', () => { expect.assertions(1) const ex...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/list/reduce.js
list/reduce.js
const signature = require('../_internal/debug/signature') const reduceWhile = require('./reduceWhile') // reduce :: Function -> Any -> Iterable -> Any const reduce = reduceWhile(null) module.exports = reduce // Experimental debug code /* istanbul ignore next */ if (process.env.MOJI_DEBUG === 'true') { module.expor...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/list/map.js
list/map.js
const signature = require('../_internal/debug/signature') const call = require('../_internal/call') const reduceWhile = require('./reduceWhile') const isIterable = require('../_internal/isIterable') const isFunctor = require('../_internal/isFunctor') const asyncMapReducer = func => acc => x => call(val => (acc.push(va...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/list/filter.js
list/filter.js
const signature = require('../_internal/debug/signature') const call = require('../_internal/call') const reduceWhile = require('./reduceWhile') const asyncFilterReducer = func => acc => x => call(val => (val && acc.push(x), acc))(func(x)) // filter :: Function -> Filterable -> Array const filter = predicate => itera...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/list/sort.js
list/sort.js
const signature = require('../_internal/debug/signature') // sort :: Function -> Iterable -> Array const sort = func => iterable => [ ...iterable ].sort((a, b) => func(a)(b)) module.exports = sort // Experimental debug code /* istanbul ignore next */ if (process.env.MOJI_DEBUG === 'true') { module.exports = signat...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/list/flatMap.js
list/flatMap.js
const signature = require('../_internal/debug/signature') const reduce = require('./reduce') const call = require('../_internal/call') const flatMapReducer = func => acc => x => call(val => acc.concat(val))(func(x)) const isFlatMapable = mapable => mapable && typeof mapable.flatMap === 'function' const isFlFlatMapable...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/list/tail.js
list/tail.js
const signature = require('../_internal/debug/signature') const is = require('../type/is') const isArray = is(Array) const isFunction = is(Function) // tail :: Array -> Array const tail = iterable => isArray(iterable) ? iterable.slice(1) : iterable && isFunction(iterable.next) ? [ ...iterable ].slice(1) : (() =...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/list/range.js
list/range.js
const signature = require('../_internal/debug/signature') // range :: Number -> Number -> Iterable const range = start => function* range(end) { let current = start while (current < end) yield current++ } module.exports = range // Experimental debug code /* istanbul ignore next */ if (process.env.MOJI_DEBUG === ...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/list/join.js
list/join.js
const signature = require('../_internal/debug/signature') // join :: Array -> Array -> Array const join = separator => list => Array.prototype.join.call(list, separator) module.exports = join // Experimental debug code /* istanbul ignore next */ if (process.env.MOJI_DEBUG === 'true') { module.exports = signature('...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/list/reduceWhile.js
list/reduceWhile.js
const signature = require('../_internal/debug/signature') const is = require('../type/is') const isThenable = require('../_internal/isThenable') const iterableSerialReduceWhile = require('../_internal/iterableSerialReduceWhile') const isFunction = is(Function) const reduceWhileIterator = (predicate, func, initial, it...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/list/ap.js
list/ap.js
const flatMap = require('./flatMap') const map = require('./map') // ap :: Apply f => f (a -> b) -> f a -> f b const ap = func => value => flatMap(f => map(v => f(v))(value))(func) module.exports = ap
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/list/head.js
list/head.js
const signature = require('../_internal/debug/signature') const is = require('../type/is') const isArray = is(Array) const isFunction = is(Function) // head :: Array -> Any const head = iterable => isArray(iterable) ? iterable[0] : iterable && isFunction(iterable.next) ? iterable.next().value : (() => { throw n...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/list/__tests__/ap.test.js
list/__tests__/ap.test.js
const ap = require('../ap') describe('list/ap', () => { describe('Array', () => { const expected = [ 1, 2, 3, 4, 5, 1, 16, 81, 256, 625 ] const actual = ap([ Math.sqrt, x => x * x ])([ 1, 4, 9, 16, 25 ]) expect(actual).toEqual(expected) }) describe('Functor', () => { const monad = value => ({ ...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/list/__tests__/join.test.js
list/__tests__/join.test.js
const join = require('../join') describe('list/join', () => { test('joins', () => { const expected = '1,2,3' const actual = join(',')([ 1, 2, 3 ]) expect(actual).toBe(expected) }) })
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/list/__tests__/reduce.test.js
list/__tests__/reduce.test.js
const range = require('../range') const reduce = require('../reduce') describe('list/reduce', () => { const isEven = num => num % 2 === 0 const add = x => y => x + y const asyncAdd = x => y => Promise.resolve(y).then(add(x)) const asyncWhenEvenAdd = x => y => isEven(y) ? asyncAdd(x)(y) : add(x)(y) test('syn...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/list/__tests__/range.test.js
list/__tests__/range.test.js
const range = require('../range') describe('list/range', () => { test('creates range', () => { const expected = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ] const actual = [ ...range(0)(10) ] expect(actual).toMatchObject(expected) }) })
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/list/__tests__/flatMap.test.js
list/__tests__/flatMap.test.js
const flatMap = require('../flatMap') describe('flatMap', () => { const double = x => x * 2 describe('Functor', () => { test('flatMap on Functor', () => { const expected = 888 const Functor = { flatMap: func => func(444) } const actual = flatMap(double)(Functor) expect(ac...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/list/__tests__/sort.test.js
list/__tests__/sort.test.js
const sort = require('../sort') const range = require('../range') describe('list/sort', () => { const descending = a => b => b - a const ascending = a => b => a - b function* iterator() { yield 5 yield 2 yield 3 } test('sort range ascending', () => { const expected = [ 5, 6, 7, 8, 9 ] co...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/list/__tests__/tail.test.js
list/__tests__/tail.test.js
const tail = require('../tail') const range = require('../range') describe('list/tail', () => { test('tail of array', () => { expect.assertions(1) const expected = [ 2, 3 ] const actual = tail([ 1, 2, 3 ]) expect(actual).toEqual(expected) }) test('tail of range', () => { expect.assertions(1...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/list/__tests__/filter.test.js
list/__tests__/filter.test.js
const filter = require('../filter') describe('list/filter', () => { const isOdd = num => num % 2 !== 0 const asyncIsOdd = num => Promise.resolve(num).then(isOdd) const asyncWhenIsOdd = num => isOdd(num) ? true : asyncIsOdd(num) function* iterator() { yield 1 yield 2 yield 3 } test('sync array...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/list/__tests__/map.test.js
list/__tests__/map.test.js
const map = require('../map') const Just = require('../../type/Just') const Nothing = require('../../type/Nothing') describe('list/map', () => { const isOdd = num => num % 2 !== 0 const double = num => num * 2 const asyncDouble = num => Promise.resolve(num).then(double) const asyncWhenOddDouble = num => isOdd(...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/list/__tests__/head.test.js
list/__tests__/head.test.js
const head = require('../head') const range = require('../range') describe('list/head', () => { test('head of array', () => { expect.assertions(1) const expected = 1 const actual = head([ 1, 2, 3 ]) expect(actual).toBe(expected) }) test('head of range', () => { expect.assertions(1) cons...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/list/__tests__/reduceWhile.test.js
list/__tests__/reduceWhile.test.js
const reduceWhile = require('../reduceWhile') const range = require('../range') describe('list/reduceWhile', () => { const isEven = num => num % 2 === 0 const add = x => y => x + y const predicate = acc => () => acc <= 2 const asyncAdd = x => y => Promise.resolve(x).then(add(y)) const largePredicate = acc =>...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/combinators/S.js
combinators/S.js
const S = f => g => x => f(x)(g(x)) module.exports = S
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/combinators/W.js
combinators/W.js
const W = f => x => f(x)(x) module.exports = W
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/combinators/K.js
combinators/K.js
const K = x => () => x module.exports = K
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/combinators/I.js
combinators/I.js
const I = x => x module.exports = I
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/combinators/__tests__/I.test.js
combinators/__tests__/I.test.js
const I = require('../I') describe('combinators/I', () => { test('returns value', () => { const expected = 888 const actual = I(expected) expect(actual).toBe(expected) }) })
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/combinators/__tests__/S.test.js
combinators/__tests__/S.test.js
const S = require('../S') describe('combinators/S', () => { test('returns value', () => { const expected = 30 const f = a => b => a + b const g = a => a * 2 const actual = S(f)(g)(10) expect(actual).toBe(expected) }) })
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/combinators/__tests__/W.test.js
combinators/__tests__/W.test.js
const W = require('../W') describe('combinators/W', () => { test('returns value', () => { const expected = 888 const f = a => b => a + b const actual = W(f)(444) expect(actual).toBe(expected) }) })
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/combinators/__tests__/K.test.js
combinators/__tests__/K.test.js
const K = require('../K') describe('combinators/K', () => { test('returns value', () => { const expected = 888 const actual = K(expected)(666) expect(actual).toBe(expected) }) })
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/console/error.js
console/error.js
const signature = require('../_internal/debug/signature') const tap = require('../function/tap') // error :: a -> a const error = tap(x => console.error(x)) // eslint-disable-line no-console module.exports = error // Experimental debug code /* istanbul ignore next */ if (process.env.MOJI_DEBUG === 'true') { module...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/console/logF.js
console/logF.js
const signature = require('../_internal/debug/signature') const tap = require('../function/tap') // logF :: Function -> a -> a const logF = func => tap(x => console.log(func(x))) // eslint-disable-line no-console module.exports = logF // Experimental debug code /* istanbul ignore next */ if (process.env.MOJI_DEBUG =...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/console/log.js
console/log.js
const signature = require('../_internal/debug/signature') const tap = require('../function/tap') // log :: a -> a const log = tap(x => console.log(x)) // eslint-disable-line no-console module.exports = log // Experimental debug code /* istanbul ignore next */ if (process.env.MOJI_DEBUG === 'true') { module.exports...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/console/__tests__/error.test.js
console/__tests__/error.test.js
const error = require('../error') describe('console/error', () => { beforeEach(() => jest.spyOn(global.console, 'error').mockImplementation(() => {})) afterEach(() => global.console.error.mockReset()) test('calls console.error', () => { const expected = 888 error(expected) const actual = global.cons...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/console/__tests__/log.test.js
console/__tests__/log.test.js
const log = require('../log') describe('console/log', () => { beforeEach(() => jest.spyOn(global.console, 'log').mockImplementation(() => {})) afterEach(() => global.console.log.mockReset()) test('calls console.log', () => { const expected = 888 log(expected) const actual = global.console.log.mock.c...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/console/__tests__/logF.test..js
console/__tests__/logF.test..js
const logF = require('../logF') describe('console/logF', () => { beforeEach(() => jest.spyOn(global.console, 'log').mockImplementation(() => {})) afterEach(() => global.console.log.mockReset()) const double = x => x * 2 test('calls console.log', () => { const expected = 888 logF(double)(444) cons...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/net/axios.js
net/axios.js
const axios = require('axios') const signature = require('../_internal/debug/signature') module.exports.get = url => options => axios.get(url, options) module.exports.delete = url => options => axios.delete(url, options) module.exports.head = url => options => axios.head(url, options) module.exports.options = url => o...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/net/__tests__/axios.tests.js
net/__tests__/axios.tests.js
const actualAxios = require('axios') const axios = require('../axios') describe('net/axios', () => { beforeEach(() => { jest.spyOn(actualAxios, 'get').mockImplementation(() => {}) jest.spyOn(actualAxios, 'delete').mockImplementation(() => {}) jest.spyOn(actualAxios, 'head').mockImplementation(() => {}) ...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/object/pathOr.js
object/pathOr.js
const signature = require('../_internal/debug/signature') // pathOr :: Any -> [String] -> Object -> Any const pathOr = fallback => path => o => { for (const key of path) { // eslint-disable-line no-restricted-syntax if (!o || !Object.prototype.hasOwnProperty.call(o, key)) { return fallback } o = o[...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/object/clone.js
object/clone.js
const signature = require('../_internal/debug/signature') const is = require('../type/is') // clone :: Any -> Any const clone = x => { if (is(Array)(x)) return [ ...x ] if (is(Function)(x)) return x.bind({}) if (is(Set)(x)) return new Set(x) if (is(Map)(x)) return new Map(x) if (is(Object)(x)) return { ...x ...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/object/propOr.js
object/propOr.js
const signature = require('../_internal/debug/signature') const pathOr = require('./pathOr') // propOr :: Any -> String -> Object -> Any const propOr = fallback => prop => o => pathOr(fallback)([ prop ])(o) module.exports = propOr // Experimental debug code /* istanbul ignore next */ if (process.env.MOJI_DEBUG === '...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/object/__tests__/pathOr.test.js
object/__tests__/pathOr.test.js
const pathOr = require('../pathOr') describe('object/pathOr', () => { test('empty', () => { const fallbackValue = 'fallback' expect(pathOr(fallbackValue)([])({ a: 1 })).toStrictEqual({ a: 1 }) expect(pathOr(fallbackValue)([ 'b' ])({})).toBe(fallbackValue) }) test('fallbacks', () => { const fallb...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/object/__tests__/propOr.test.js
object/__tests__/propOr.test.js
const propOr = require('../propOr') describe('object/propOr', () => { test('fallbacks', () => { const fallbackValue = 'fallback' expect(propOr(fallbackValue)('')({})).toBe(fallbackValue) expect(propOr(fallbackValue)('')({ a: 1 })).toBe(fallbackValue) expect(propOr(fallbackValue)('a')({})).toBe(fallba...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/object/__tests__/clone.test.js
object/__tests__/clone.test.js
const clone = require('../clone') describe('clone/clone', () => { test('clones an array', () => { const original = [ 1, 2, 3 ] const cloned = clone(original) expect(cloned).toEqual(original) expect(cloned).not.toBe(original) }) test('clones an object', () => { const original = { foo: 'bar' }...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/examples/parcel-hello-world/main.js
examples/parcel-hello-world/main.js
import pipe from 'mojiscript/core/pipe' import { setInnerText, getElementById } from './interop/dom.js' const main = ({ document }) => pipe ([ getElementById (document), setInnerText ('Hello World!') ]) export default main
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/examples/parcel-hello-world/index.js
examples/parcel-hello-world/index.js
import run from 'mojiscript/core/run' import main from './main' const state = 'app' const dependencies = { document: global.document } run ({ dependencies, state, main })
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/examples/parcel-hello-world/interop/dom.js
examples/parcel-hello-world/interop/dom.js
export const setInnerText = text => element => element.innerText = text export const getElementById = document => id => document.getElementById(id)
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/core/into.js
core/into.js
// into :: String -> Function -> * -> * const into = prop => func => value => Promise.resolve(value) .then(func) .then(result => Object.assign({}, value, { [prop]: result })) module.exports = into
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/core/after.js
core/after.js
const after = first => last => value => Promise.resolve(first(value)).then(() => last(value)) module.exports = after
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/core/pipeR.js
core/pipeR.js
const maybeExec = require('../_internal/maybeExec') const pipeR = func => value => func(pipeR(func)).reduce( (acc, func) => acc.then(maybeExec(func)), Promise.resolve(value) ) module.exports = pipeR
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/core/run.js
core/run.js
const error = require('../console/error') const run = ({ dependencies, state, main }) => dependencies != null ? run({ state, main: main(dependencies) }) : main(state).catch((dependencies || {}).error || error) module.exports = run
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false
joelnet/MojiScript
https://github.com/joelnet/MojiScript/blob/1bc7f43fdc105ed252aa3071e22a84676d84fbe1/core/__tests__/after.test.js
core/__tests__/after.test.js
const after = require('../after') describe('core/after', () => { test('value sent to f', async () => { expect.assertions(1) const expected = 888 const f = jest.fn() const g = jest.fn() await after(f)(g)(expected) const actual = f.mock.calls[0][0] expect(actual).toBe(expected) }) test...
javascript
MIT
1bc7f43fdc105ed252aa3071e22a84676d84fbe1
2026-01-05T03:37:36.859683Z
false