forked from 0x2620/oxjs
rather use ''.slice than ''.substr
This commit is contained in:
parent
f990f3b857
commit
1608664bb6
20 changed files with 69 additions and 71 deletions
|
|
@ -76,7 +76,7 @@ Ox.doc = (function() {
|
|||
// or if the second last char is a single or double quote
|
||||
return matches && (
|
||||
matches[2].indexOf('/') == -1 ||
|
||||
'\'"'.indexOf(matches[2].substr(-2, 1)) > -1
|
||||
'\'"'.indexOf(matches[2].slice(-2, -1)) > -1
|
||||
) ? Ox.extend({
|
||||
name: parseName(matches[1].trim()),
|
||||
summary: matches[3].trim()
|
||||
|
|
@ -163,7 +163,7 @@ Ox.doc = (function() {
|
|||
// main item
|
||||
// include leading whitespace
|
||||
item.source = parseTokens(tokens[i]);
|
||||
item.line = source.substr(0, item.source[0].offset)
|
||||
item.line = source.slice(0, item.source[0].offset)
|
||||
.split('\n').length;
|
||||
items.push(item);
|
||||
} else {
|
||||
|
|
@ -186,7 +186,7 @@ Ox.doc = (function() {
|
|||
// fixme: we cannot properly handle tests where a string contains '\n '
|
||||
var lines = decodeLinebreaks(str).split('\n ');
|
||||
return {
|
||||
statement: lines[0].substr(2),
|
||||
statement: lines[0].slice(2),
|
||||
result: lines[1].trim()
|
||||
};
|
||||
}
|
||||
|
|
@ -258,7 +258,7 @@ Ox.doc = (function() {
|
|||
split,
|
||||
type;
|
||||
// only split by ':' if there is no default string value
|
||||
if ('\'"'.indexOf(str.substr(-2, 1)) == -1) {
|
||||
if ('\'"'.indexOf(str.slice(-2, -1)) == -1) {
|
||||
split = str.split(':');
|
||||
str = split[0];
|
||||
if (split.length == 2) {
|
||||
|
|
@ -637,7 +637,7 @@ Ox.tokenize = (function() {
|
|||
identifier: function() {
|
||||
var str;
|
||||
while ((identifier + number).indexOf(source[++cursor]) > -1) {}
|
||||
str = source.substring(start, cursor);
|
||||
str = source.slice(start, cursor);
|
||||
Ox.forEach(word, function(value, key) {
|
||||
if (value.indexOf(str) > -1) {
|
||||
type = key;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue