1
0
mirror of https://github.com/gabemart/hipku.git synced 2025-01-31 10:10:51 +00:00

Remove the useless nonWords

This commit is contained in:
lord63 2015-02-25 10:59:51 +08:00
parent 3f8749e7da
commit a78eba66f2
2 changed files with 10 additions and 18 deletions

12
dist/hipku.js vendored
View File

@ -244,9 +244,7 @@ function writeHaiku(wordArray, ipv6) {
var octet, schemaResults, schema, nonWords, haiku; var octet, schemaResults, schema, nonWords, haiku;
octet = 'OCTET'; // String to place in schema to show word slots octet = 'OCTET'; // String to place in schema to show word slots
schemaResults = getSchema(ipv6, octet); schema = getSchema(ipv6, octet);
schema = schemaResults[0];
nonWords = schemaResults[1];
/* /*
** Replace each instance of 'octet' in the schema with a word from ** Replace each instance of 'octet' in the schema with a word from
@ -327,13 +325,11 @@ function getSchema(ipv6, octet) {
var insertSpace = true; var insertSpace = true;
/* /*
** If the next entry is a nonWord, don't add a space ** If the current entry is a nonWord, don't add a space
*/ */
for (var j = 0; j < nonWords.length; j++) { if (schema[i] in nonWords) {
if (schema[i] === nonWords[j]) {
insertSpace = false; insertSpace = false;
} }
}
/* /*
** If the previous entry is a newLine, don't add a space ** If the previous entry is a newLine, don't add a space
@ -348,7 +344,7 @@ function getSchema(ipv6, octet) {
} }
} }
return [schema, nonWords]; return schema;
} }
function capitalizeHaiku(haikuArray) { function capitalizeHaiku(haikuArray) {

View File

@ -244,9 +244,7 @@ function writeHaiku(wordArray, ipv6) {
var octet, schemaResults, schema, nonWords, haiku; var octet, schemaResults, schema, nonWords, haiku;
octet = 'OCTET'; // String to place in schema to show word slots octet = 'OCTET'; // String to place in schema to show word slots
schemaResults = getSchema(ipv6, octet); schema = getSchema(ipv6, octet);
schema = schemaResults[0];
nonWords = schemaResults[1];
/* /*
** Replace each instance of 'octet' in the schema with a word from ** Replace each instance of 'octet' in the schema with a word from
@ -327,13 +325,11 @@ function getSchema(ipv6, octet) {
var insertSpace = true; var insertSpace = true;
/* /*
** If the next entry is a nonWord, don't add a space ** If the current entry is a nonWord, don't add a space
*/ */
for (var j = 0; j < nonWords.length; j++) { if (schema[i] in nonWords) {
if (schema[i] === nonWords[j]) {
insertSpace = false; insertSpace = false;
} }
}
/* /*
** If the previous entry is a newLine, don't add a space ** If the previous entry is a newLine, don't add a space
@ -348,7 +344,7 @@ function getSchema(ipv6, octet) {
} }
} }
return [schema, nonWords]; return schema;
} }
function capitalizeHaiku(haikuArray) { function capitalizeHaiku(haikuArray) {