Moved the main file into lib, v0.0.3

This commit is contained in:
martind2000 2016-04-10 10:33:28 +01:00
parent a87317b5c3
commit 8a756ba108
2 changed files with 17 additions and 12 deletions

View File

@ -1,6 +1,5 @@
'use strict';
/** /**
* * *
* User: Martin Donnelly * User: Martin Donnelly
* Date: 2016-03-15 * Date: 2016-03-15
* Time: 15:08 * Time: 15:08
@ -46,7 +45,7 @@ module.exports = {
} }
return rObj; return rObj;
}, sanitiseObj: function(obj, methods) { }, sanitiseObj(obj, methods) {
for (var item in methods) { for (var item in methods) {
if (obj.hasOwnProperty(item)) { if (obj.hasOwnProperty(item)) {
if (typeof obj[item] === 'string') { if (typeof obj[item] === 'string') {
@ -61,9 +60,9 @@ module.exports = {
var s = []; var s = [];
var SCRIPT_REGEX = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi; var SCRIPT_REGEX = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi;
var CHECKCHARS = "0123456789" + // Numeric var CHECKCHARS = '0123456789' + // Numeric
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" + // Alphabetic 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + // Alphabetic
"abcdefghijklmnopqrstuvwxyz-'" + (_loose === false ? '' : "_,.!~*()@:+/\\"); "abcdefghijklmnopqrstuvwxyz-'" + (_loose === false ? '' : "_,.!~*()@:+/\\");// jscs:ignore validateQuoteMarks
if (typeof text === 'string') { if (typeof text === 'string') {
while (SCRIPT_REGEX.test(text)) { while (SCRIPT_REGEX.test(text)) {
@ -74,18 +73,17 @@ module.exports = {
ch = text.charAt(i); ch = text.charAt(i);
if (ch === ' ') { if (ch === ' ') {
s.push(' '); s.push(' ');
} } else if (ch.charCodeAt(0) < 255 && CHECKCHARS.indexOf(ch) !== -1) {
else if (ch.charCodeAt(0) < 255 && CHECKCHARS.indexOf(ch) !== -1) {
s.push(ch); s.push(ch);
} }
} }
text = s.join('').trim(); text = s.join('').trim();
} }
return text; return text;
}, cloneTrim: function(from) { }, cloneTrim(from) {
var _out = {}; var _out = {};
if (typeof from === 'object' && Object.keys(from).length !== 0) { if (typeof from === 'object' && Object.keys(from).length !== 0) {
// copy the required fields into the data object.. // Copy the required fields into the data object..
for (var key in from) { for (var key in from) {
if (from.hasOwnProperty(key)) { if (from.hasOwnProperty(key)) {

View File

@ -1,11 +1,18 @@
{ {
"name": "md-utils", "name": "md-utils",
"version": "0.0.2", "version": "0.0.3",
"description": "A suite of useful misc utils", "description": "A suite of useful misc utils",
"main": "index.js", "repository": {
"type": "git",
"url": "http://gitlab.silvrtree.co.uk/martind2000/md-utils.git"
},
"main": "lib/md-utils.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"dependencies": {},
"devDependencies": {
},
"author": "Martin Donnelly <martind2000@gmail.com>", "author": "Martin Donnelly <martind2000@gmail.com>",
"license": "ISC" "license": "ISC"
} }