is-offset
Checks if a string is the offset of another.
Node Repository
https://www.npmjs.com/package/@pelevesque/is-offset
Installation
npm install @pelevesque/is-offset
Tests
Command | Description |
---|---|
npm test or npm run test
|
All Tests Below |
npm run cover |
Standard Style |
npm run standard |
Coverage |
npm run unit |
Unit Tests |
Usage
Parameters
str1 (required)
str2 (required)
step (optional) default = 1
Examples
const isOffset = require('@pelevesque/is-offset')
const str1 = 'abcd'
const str2 = 'efgh'
const result = isOffset(str1, str2)
// result === false
const str1 = 'abcd'
const str2 = 'bcda'
const result = isOffset(str1, str2)
// result === true
const str1 = '111222333444'
const str2 = '333444111222'
const step = 3
const result = isOffset(str1, str2, step)
// result === true