Skip to content

Instantly share code, notes, and snippets.

@loggerhead
Last active October 25, 2023 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loggerhead/155bb3906158b229d348602a66231087 to your computer and use it in GitHub Desktop.
Save loggerhead/155bb3906158b229d348602a66231087 to your computer and use it in GitHub Desktop.
diff-example
[
{
"recharge": 900000
},
{
"available": 0
}
]
world
a
c
} ;
}
} return tokens;
};
wordDiff.tokenize = function(value) {
const tokens = [];
let prevCharType = '';
for (let i = 0; i < value.length; i++) {
const char = value[i];
if (spaceRegExp.test(char)) {
if(prevCharType === 'space') {
tokens[tokens.length - 1] += ' ';
} else {
tokens.push(' ');
}
prevCharType = 'space';
} else if (cannotBecomeWordRegExp.test(char)) {
tokens.push(char);
prevCharType = '';
} else {
if(prevCharType === 'word') {
tokens[tokens.length - 1] += char;
} else {
tokens.push(char);
}
prevCharType = 'word';
}
}
return tokens;
};
{
"Aidan Gillen": {
"array": [
"Game of Thrones",
"The Wire"
],
"string": "some string",
"int": "2",
"otherint": 4,
"aboolean": "true",
"boolean": false,
"null": null,
"a_null": 88,
"another_null": null,
"object": {
"foo": "bar"
}
},
"Amy Ryan": [
"In Treatment",
"The Wire"
],
"Annie Fitzgerald": [
"True Blood",
"Big Love",
"The Sopranos",
"Oz"
],
"Anwan Glover": [
"Treme",
"The Wire"
],
"Alexander Skarsg?rd": [
"Generation Kill",
"True Blood"
],
"Alice Farmer": [
"The Corner",
"Oz",
"The Wire"
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment