Skip to content

Commit

Permalink
Remove lodash
Browse files Browse the repository at this point in the history
  • Loading branch information
mooniker committed Oct 13, 2019
1 parent e47dc3f commit b5ca9ff
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 101 deletions.
8 changes: 6 additions & 2 deletions jamo.js
@@ -1,7 +1,11 @@
// "...what have the Romans ever done for us?"

const isHangul = require("./hangul/isHangul");
const _ = require("lodash");
const fromPairs = pairs =>
pairs.reduce((cache, pair) => {
cache[pair[0]] = pair[1];
return cache;
}, {});

const [
initialConsonants,
Expand Down Expand Up @@ -119,7 +123,7 @@ const jungseong = [
].map(jamoMapper(medialVowels));

const assimilate = (jamos, sound) =>
_.fromPairs(jamos.map(jamo => [jamo, sound]));
fromPairs(jamos.map(jamo => [jamo, sound]));

const nasalAssimilators = [
"ㄴ",
Expand Down
1 change: 0 additions & 1 deletion jamo.test.js
@@ -1,5 +1,4 @@
const [initialConsonants, medialVowels, finalConsonants] = require("./jamo");
const _ = require("lodash");

describe("Jamo dictionary", () => {
test("should contain array of initial consonants (choseong)", () => {
Expand Down
200 changes: 105 additions & 95 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Expand Up @@ -38,7 +38,6 @@
"license": "UNLICENSED",
"devDependencies": {
"jest": "^24.9.0",
"lodash": "^4.17.15",
"unicode": "^12.1.0"
},
"dependencies": {},
Expand Down
4 changes: 2 additions & 2 deletions romanize.js
@@ -1,10 +1,10 @@
const replaceHangul = require("./hangul/hangulReplace");
const { decomposeHangul } = require("./hangul/unicode/decompose");
const jamos = require("./jamo");
const _ = require("lodash");

const getJamoDictionary = (jamo, idx) =>
_.find(jamos[idx], { jamo }) || _.find(jamos[idx], { compatJamo: jamo });
jamos[idx].find(o => o.jamo === jamo) ||
jamos[idx].find(o => o.compatJamo === jamo);

function searchJamo(node, params, prevNode) {
const { method, vowelNext, consonantNext, consonantPrev } = params || {
Expand Down

0 comments on commit b5ca9ff

Please sign in to comment.