0.0.1 • Published 10 years ago

stringx v0.0.1

Weekly downloads
3
License
ISC
Repository
github
Last release
10 years ago

stringx

Yet another string utility dealing with startsWith, endsWith and etc.

#Installation npm install stringx

#Usage

var stringx = require('./stringx');

describe('stringx Suite', function () {
    beforeEach(function () {
    });
    afterEach(function () {
    });

    it('should work: startsWith', function () {
        expect(stringx.startsWith('abcdefg', 'a')).toBeTruthy();
        expect(stringx.startsWith('abcdefg', 'ab')).toBeTruthy();
        expect(stringx.startsWith('abcdefg', '')).toBeTruthy();
        expect(stringx.startsWith('abcdefg', 'x')).toBeFalsy();
        expect(stringx.startsWith('abcdefg', 'g')).toBeFalsy();
    });
    it('should work: endsWith', function () {
        expect(stringx.endsWith('abcdefg', 'g')).toBeTruthy();
        expect(stringx.endsWith('abcdefg', 'fg')).toBeTruthy();
        expect(stringx.endsWith('abcdefg', '')).toBeTruthy();
        expect(stringx.endsWith('abcdefg', 'x')).toBeFalsy();
        expect(stringx.endsWith('abcdefg', 'a')).toBeFalsy();
    });
});