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

metarhia-common

Package Overview
Dependencies
Maintainers
3
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metarhia-common - npm Package Compare versions

Comparing version 0.0.18 to 0.0.19

test/strings.js

26

lib/strings.js

@@ -203,2 +203,26 @@ 'use strict';

const section = (
// Splits string by the first occurrence of separator
s, // String
separator // char or String
// Example: rsection('All you need is JavaScript', 'is')
// Returns: ['All you need ', ' JavaScript']
) => {
const i = s.indexOf(separator);
if (i < 0) return [s, ''];
return [s.slice(0, i), s.slice(i + separator.length)];
};
const rsection = (
// Splits string by the last occurrence of separator
s, // String
separator // char or String
// Example: rsection('All you need is JavaScript', 'a')
// Returns: ['All you need is Jav', 'Script']
) => {
const i = s.lastIndexOf(separator);
if (i < 0) return [s, ''];
return [s.slice(0, i), s.slice(i + separator.length)];
};
module.exports = {

@@ -219,2 +243,4 @@ subst,

arrayRegExp,
section,
rsection,
};

2

package.json
{
"name": "metarhia-common",
"version": "0.0.18",
"version": "0.0.19",
"author": "Timur Shemsedinov <timur.shemsedinov@gmail.com>",

@@ -5,0 +5,0 @@ "description": "Metarhia Common Library",

@@ -421,2 +421,16 @@ # Metarhia Common Library

## Splits string by the first occurrence of separator
`common.section`
- `s` - String
- `separator` - char or String
- Example: rsection('All you need is JavaScript', 'is')
- Returns: ['All you need ', ' JavaScript']
## Splits string by the last occurrence of separator
`commin.rsection`
- `s` - String
- `separator` - char or String
- Example: rsection('All you need is JavaScript', 'a')
- Returns: ['All you need is Jav', 'Script']
## Contributors

@@ -423,0 +437,0 @@

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