Toggle navigation
Toggle navigation
This project
Loading...
Sign in
이찬
/
opensource_term_project
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
이찬
2020-06-11 18:02:25 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
646f858164f712233eff3cd7e7a8a0392cf49474
646f8581
1 parent
f4f981f3
format 추가
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
45 deletions
js/josa.js
js/josa.js
View file @
646f858
var
_f
=
[
function
(
string
)
{
//을/를 구분
return
_hasJong
(
string
)
?
'을'
:
'를'
;
},
function
(
string
){
//은/는 구분
return
_hasJong
(
string
)
?
'은'
:
'는'
;
},
function
(
string
){
//이/가 구분
return
_hasJong
(
string
)
?
'이'
:
'가'
;
},
function
(
string
){
//와/과 구분
return
_hasJong
(
string
)
?
'과'
:
'와'
;
}
],
_formats
=
{
'을/를'
:
_f
[
0
],
'을'
:
_f
[
0
],
'를'
:
_f
[
0
],
'을를'
:
_f
[
0
],
'은/는'
:
_f
[
1
],
'은'
:
_f
[
1
],
'는'
:
_f
[
1
],
'은는'
:
_f
[
1
],
'이/가'
:
_f
[
2
],
'이'
:
_f
[
2
],
'가'
:
_f
[
2
],
'이가'
:
_f
[
2
],
'와/과'
:
_f
[
3
],
'와'
:
_f
[
3
],
'과'
:
_f
[
3
],
'와과'
:
_f
[
3
]
};
function
_hasJong
(
string
){
//string의 마지막 글자가 받침을 가지는지 확인
string
=
string
.
charCodeAt
(
string
.
length
-
1
);
return
(
string
-
0xac00
)
%
28
>
0
;
var
_f
=
[
function
(
string
)
{
//을/를 구분
return
_hasJong
(
string
)
?
'을'
:
'를'
;
},
function
(
string
)
{
//은/는 구분
return
_hasJong
(
string
)
?
'은'
:
'는'
;
},
function
(
string
)
{
//이/가 구분
return
_hasJong
(
string
)
?
'이'
:
'가'
;
},
function
(
string
)
{
//와/과 구분
return
_hasJong
(
string
)
?
'과'
:
'와'
;
},
function
(
string
)
{
//으로/로 구분
return
_hasJong
(
string
)
?
'으로'
:
'로'
;
}
var
josa
=
{
c
:
function
(
word
,
format
){
if
(
typeof
_formats
[
format
]
===
'undefined'
)
throw
'Invalid format!'
;
return
_formats
[
format
](
word
);
},
r
:
function
(
word
,
format
)
{
return
word
+
josa
.
c
(
word
,
format
);
}
],
_formats
=
{
'을/를'
:
_f
[
0
],
'을'
:
_f
[
0
],
'를'
:
_f
[
0
],
'을를'
:
_f
[
0
],
'은/는'
:
_f
[
1
],
'은'
:
_f
[
1
],
'는'
:
_f
[
1
],
'은는'
:
_f
[
1
],
'이/가'
:
_f
[
2
],
'이'
:
_f
[
2
],
'가'
:
_f
[
2
],
'이가'
:
_f
[
2
],
'와/과'
:
_f
[
3
],
'와'
:
_f
[
3
],
'과'
:
_f
[
3
],
'와과'
:
_f
[
3
],
'으로'
:
_f
[
4
],
'로'
:
_f
[
4
],
'으로/로'
:
_f
[
4
]
};
function
_hasJong
(
string
)
{
//string의 마지막 글자가 받침을 가지는지 확인
string
=
string
.
charCodeAt
(
string
.
length
-
1
);
return
(
string
-
0xac00
)
%
28
>
0
;
}
var
josa
=
{
c
:
function
(
word
,
format
)
{
if
(
typeof
_formats
[
format
]
===
'undefined'
)
throw
'Invalid format!'
;
return
_formats
[
format
](
word
);
},
r
:
function
(
word
,
format
)
{
return
word
+
josa
.
c
(
word
,
format
);
}
};
...
...
Please
register
or
login
to post a comment