Skip to content

Instantly share code, notes, and snippets.

View saswatds's full-sized avatar
🙇‍♀️
Computer Linguist

Saswat Das saswatds

🙇‍♀️
Computer Linguist
View GitHub Profile
@saswatds
saswatds / patcher.js
Created November 23, 2021 14:04
JSON Patch to MongoDB Patch
/**
* NOTE: This algorithm only works for Mongodb version 4.2 where aggregate queries were introduced.
*
*/
const ZERO = 0,
ONE = 1,
unescape = (str) => str.replace(/~1/g, '/').replace(/~0/g, '~'),
parse = (pointer) => {
if (pointer === '') { return []; }
const PORT = 8080,
http = require('http'),
fs = require('fs'),
path = require('path');
http.createServer(function (req, res) {
switch (req.url) {
case '/utf16be':
res.writeHead(200, { 'Content-Type': 'application/json;charset=utf-16be' });
// { "get": true }

Keybase proof

I hereby claim:

  • I am saswatds on github.
  • I am sassdazz (https://keybase.io/sassdazz) on keybase.
  • I have a public key ASCcqCA9va0d7Xfc7-f3fJqawNiqhGJvCp1OpC-spPFFAAo

To claim this, I am signing this object: