Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/preprocessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function smokeTestMethods(data) {

if (
classitem.access !== 'private' &&
classitem.file.substr(0, 3) === 'src' &&
classitem.file.slice(0, 3) === 'src' &&
classitem.name &&
!classitem.example
) {
Expand Down
4 changes: 2 additions & 2 deletions src/core/friendly_errors/sketch_reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ if (typeof IS_MINIFIED !== 'undefined') {
//create a new string which don't have multiline comments
while (start !== -1 && end !== -1) {
if (start === 0) {
code = code.substr(end + 2);
} else code = code.substr(0, start) + code.substr(end + 2);
code = code.slice(end + 2);
} else code = code.slice(0, start) + code.slice(end + 2);

start = code.indexOf('/*');
end = code.indexOf('*/');
Expand Down
10 changes: 5 additions & 5 deletions src/core/friendly_errors/validate_params.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ if (typeof IS_MINIFIED !== 'undefined') {
// look for the docs in the `data.json` datastructure

const ichDot = func.lastIndexOf('.');
const funcName = func.substr(ichDot + 1);
const funcClass = func.substr(0, ichDot) || 'p5';
const funcName = func.slice(ichDot + 1);
const funcClass = func.slice(0, ichDot !== -1 ? ichDot : 0) || 'p5';

const classitems = arrDoc;
let queryResult = classitems[funcClass][funcName];
Expand Down Expand Up @@ -247,10 +247,10 @@ if (typeof IS_MINIFIED !== 'undefined') {
// split this parameter's types
format.types = format.type.split('|').map(function ct(type) {
// array
if (type.substr(type.length - 2, 2) === '[]') {
if (type.slice(-2) === '[]') {
return {
name: type,
array: ct(type.substr(0, type.length - 2))
array: ct(type.slice(0, -2))
};
}

Expand Down Expand Up @@ -298,7 +298,7 @@ if (typeof IS_MINIFIED !== 'undefined') {
}

// function
if (lowerType.substr(0, 'function'.length) === 'function') {
if (lowerType.slice(0, 'function'.length) === 'function') {
lowerType = 'function';
}
// builtin
Expand Down
4 changes: 2 additions & 2 deletions src/typography/loading_displaying.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ p5.prototype.loadFont = function(path, onSuccess, onError) {
const lastDotIdx = fileNoPath.lastIndexOf('.');
let fontFamily;
let newStyle;
const fileExt = lastDotIdx < 1 ? null : fileNoPath.substr(lastDotIdx + 1);
const fileExt = lastDotIdx < 1 ? null : fileNoPath.slice(lastDotIdx + 1);

// if so, add it to the DOM (name-only) for use with DOM module
if (validFontTypes.includes(fileExt)) {
fontFamily = fileNoPath.substr(0, lastDotIdx);
fontFamily = fileNoPath.slice(0, lastDotIdx !== -1 ? lastDotIdx : 0);
newStyle = document.createElement('style');
newStyle.appendChild(
document.createTextNode(
Expand Down
16 changes: 8 additions & 8 deletions test/js/sinon.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
* @author Contributors: https://github.com/cjohansen/Sinon.JS/blob/master/AUTHORS
*
* (The BSD License)
*
*
* Copyright (c) 2010-2014, Christian Johansen, [email protected]
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
Expand All @@ -20,7 +20,7 @@
* * Neither the name of Christian Johansen nor the names of his contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Expand Down Expand Up @@ -463,7 +463,7 @@
module.exports = m(require("samsam"));
}) || function (m) { this.formatio = m(this.samsam); }
)(function (samsam) {

var formatio = {
excludeConstructors: ["Object", /^.$/],
quoteStrings: true,
Expand Down Expand Up @@ -566,7 +566,7 @@
processed.push(array);
var pieces = [];
var i, l;
l = (this.limitChildrenCount > 0) ?
l = (this.limitChildrenCount > 0) ?
Math.min(this.limitChildrenCount, array.length) : array.length;

for (i = 0; i < l; ++i) {
Expand All @@ -586,7 +586,7 @@
var pieces = [], properties = samsam.keys(object).sort();
var length = 3;
var prop, str, obj, i, k, l;
l = (this.limitChildrenCount > 0) ?
l = (this.limitChildrenCount > 0) ?
Math.min(this.limitChildrenCount, properties.length) : properties.length;

for (i = 0; i < l; ++i) {
Expand Down Expand Up @@ -636,7 +636,7 @@
var content = element.innerHTML;

if (content.length > 20) {
content = content.substr(0, 20) + "[...]";
content = content.slice(0, 20) + "[...]";
}

var res = formatted + pairs.join(" ") + ">" + content +
Expand Down
2 changes: 1 addition & 1 deletion test/unit/color/p5.Color.js
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ suite('p5.Color', function() {
test('should generate (r,g,b,a) color string with 0-1 normalized alpha', function() {
// Will not exactly equal 0.5 due to math: test "0.5" substr of
// 'rgba(128,0,128,0.5...' instead of checking the entire string
assert.equal(colorStr.substr(15, 3), '0.5');
assert.equal(colorStr.slice(15, 18), '0.5');
});

test('should consistently generate the same output', function() {
Expand Down