Socket
Socket
Sign inDemoInstall

findpattern

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    findpattern

I am tired of this s**t


Version published
Weekly downloads
2
increased by100%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

THE ABCABC KILLER PATTERN

findpattern

I am really tired about this shit... A lot of assessment for a fcking job required to make a stupid function .... thay ask to have the times of repetition of substrings like "ABCABC" ... and the same funtion need to report the length of same chars like 'CCCC'... Please, refuse test or assessment like that... not have any sense... expecially if you looking for a position as font end... Should be a 'creative' position... what is the pourpuse of this test??? ... Know if you are crazy?, stupid?... so... it's my solution for you!

This is the most used test...

a relative link

My name is Dario Passariello... you can agree with me or not... but life is short....

const findPattern = ( word ) => {

  let
  replace = word.match( /(.+)(?=.*?\1)/g ),
  pattern = new RegExp( replace , "g"),
  final = word.match( pattern );

  // console.log( replace );
  // console.log( pattern );
  // console.log( final );

  if( final )
      return final.length;
  else if
      return word.length;

};

HOW IT'S WORKS

test it:

  // 'abcabc' = 2 groups
  console.log( findPattern('abcabc') );
  
  // cccc = 4 repeated chars
  console.log( findPattern('cccc') );

Keywords

FAQs

Last updated on 14 Dec 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc