Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

absurdum

Package Overview
Dependencies
Maintainers
1
Versions
177
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

absurdum - npm Package Compare versions

Comparing version 0.34.0 to 0.35.0

docs/strings/indexOf.md

34

dist/absurdum.cjs.js

@@ -681,2 +681,35 @@ 'use strict';

/**
* IndexOf method returns the first index at which a given element can be found in the string
* beyond the starting index, or -1 if it is not present.
*
* @param {String} string input string
* @param {String} substr string to be searched for in the string
* @param {Number} [start=0] index of string to begin searching for substr
* @returns {Number} an integer representing the first index in the string that contains the substr
* @example
* const result = strings.indexOf("Lisa Browne", "Brow");
* console.log(result);
* > 5
* @example
* const result = strings.indexOf('fire earth, fire sky', 'fire', 1);
* console.log(result);
* > 12
*/
function indexOf$1 (string, substr, start = 0) {
if (string.length === 0) return -1;
const len = substr.length;
const first = substr.charAt(0);
return string.split('').reduce((res, cur, i) => {
if (i >= start) {
if (res > 0) { return res; }
if (cur === first) {
return string.substring(i, i + len) === substr ? i : -1;
}
}
return res;
}, -1);
}
/**
* Pads the end of a string w/ repeated spaces|substrings

@@ -853,2 +886,3 @@ *

includes: includes,
indexOf: indexOf$1,
padEnd: padEnd,

@@ -855,0 +889,0 @@ padStart: padStart,

@@ -677,2 +677,35 @@ /**

/**
* IndexOf method returns the first index at which a given element can be found in the string
* beyond the starting index, or -1 if it is not present.
*
* @param {String} string input string
* @param {String} substr string to be searched for in the string
* @param {Number} [start=0] index of string to begin searching for substr
* @returns {Number} an integer representing the first index in the string that contains the substr
* @example
* const result = strings.indexOf("Lisa Browne", "Brow");
* console.log(result);
* > 5
* @example
* const result = strings.indexOf('fire earth, fire sky', 'fire', 1);
* console.log(result);
* > 12
*/
function indexOf$1 (string, substr, start = 0) {
if (string.length === 0) return -1;
const len = substr.length;
const first = substr.charAt(0);
return string.split('').reduce((res, cur, i) => {
if (i >= start) {
if (res > 0) { return res; }
if (cur === first) {
return string.substring(i, i + len) === substr ? i : -1;
}
}
return res;
}, -1);
}
/**
* Pads the end of a string w/ repeated spaces|substrings

@@ -849,2 +882,3 @@ *

includes: includes,
indexOf: indexOf$1,
padEnd: padEnd,

@@ -851,0 +885,0 @@ padStart: padStart,

2

package.json
{
"name": "absurdum",
"version": "0.34.0",
"version": "0.35.0",
"description": "Reductio Ad Absurdum - The Ridiculous Application of Reduce",

@@ -5,0 +5,0 @@ "keywords": [

@@ -109,2 +109,3 @@ [![GitHub Releases](https://img.shields.io/github/release/vanillaes/absurdum.svg)](https://github.com/vanillaes/absurdum/releases)

- [includes][strings.includes]
- [indexOf][strings.indexOf]
- [padEnd][strings.padEnd]

@@ -118,2 +119,3 @@ - [padStart][strings.padStart]

[strings.includes]: ./docs/strings/includes.md
[strings.indexOf]: ./docs/strings/indexOf.md
[strings.padEnd]: ./docs/strings/padEnd.md

@@ -120,0 +122,0 @@ [strings.padStart]: ./docs/strings/padStart.md

export { endsWith } from "./endsWith.js";
export { includes } from "./includes.js";
export { indexOf } from "./indexOf.js";
export { padEnd } from "./padEnd.js";

@@ -4,0 +5,0 @@ export { padStart } from "./padStart.js";

export { endsWith } from './endsWith.js';
export { includes } from './includes.js';
export { indexOf } from './indexOf.js';
export { padEnd } from './padEnd.js';

@@ -4,0 +5,0 @@ export { padStart } from './padStart.js';

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc