Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
8665464416 | |||
e773644256 |
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartstring",
|
"name": "@pushrocks/smartstring",
|
||||||
"version": "3.0.11",
|
"version": "3.0.12",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartstring",
|
"name": "@pushrocks/smartstring",
|
||||||
"version": "3.0.11",
|
"version": "3.0.12",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "handle strings in smart ways. TypeScript ready.",
|
"description": "handle strings in smart ways. TypeScript ready.",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
@ -5,4 +5,10 @@ tap.test('should state valuid utf8', async () => {
|
|||||||
expect(smartstring.type.isUtf8('hithere')).to.be.true;
|
expect(smartstring.type.isUtf8('hithere')).to.be.true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tap.test('should state wether base64 string is valid', async () => {
|
||||||
|
const base64String = smartstring.base64.encode('hi there');
|
||||||
|
expect(smartstring.type.isBase64(base64String)).to.be.true;
|
||||||
|
expect(smartstring.type.isBase64('hi there')).to.be.false;
|
||||||
|
});
|
||||||
|
|
||||||
tap.start();
|
tap.start();
|
@ -1,4 +1,5 @@
|
|||||||
import * as plugins from './smartstring.plugins';
|
import * as plugins from './smartstring.plugins';
|
||||||
|
import * as base64 from './smartstring.base64';
|
||||||
|
|
||||||
export const isUtf8 = (stringArg: string) => {
|
export const isUtf8 = (stringArg: string) => {
|
||||||
const bytes = Buffer.from(stringArg);
|
const bytes = Buffer.from(stringArg);
|
||||||
@ -75,3 +76,7 @@ export const isUtf8 = (stringArg: string) => {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const isBase64 = (stringArg: string) => {
|
||||||
|
return stringArg.endsWith('=');
|
||||||
|
};
|
||||||
|
Reference in New Issue
Block a user