mirror of
https://gitlab.silvrtree.co.uk/martind2000/md-utils.git
synced 2025-01-25 16:26:18 +00:00
Moved the main file into lib, v0.0.3
This commit is contained in:
parent
a87317b5c3
commit
8a756ba108
@ -1,6 +1,5 @@
|
||||
'use strict';
|
||||
/**
|
||||
*
|
||||
* *
|
||||
* User: Martin Donnelly
|
||||
* Date: 2016-03-15
|
||||
* Time: 15:08
|
||||
@ -46,7 +45,7 @@ module.exports = {
|
||||
}
|
||||
|
||||
return rObj;
|
||||
}, sanitiseObj: function(obj, methods) {
|
||||
}, sanitiseObj(obj, methods) {
|
||||
for (var item in methods) {
|
||||
if (obj.hasOwnProperty(item)) {
|
||||
if (typeof obj[item] === 'string') {
|
||||
@ -61,9 +60,9 @@ module.exports = {
|
||||
var s = [];
|
||||
var SCRIPT_REGEX = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi;
|
||||
|
||||
var CHECKCHARS = "0123456789" + // Numeric
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" + // Alphabetic
|
||||
"abcdefghijklmnopqrstuvwxyz-'" + (_loose === false ? '' : "_,.!~*()@:+/\\");
|
||||
var CHECKCHARS = '0123456789' + // Numeric
|
||||
'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + // Alphabetic
|
||||
"abcdefghijklmnopqrstuvwxyz-'" + (_loose === false ? '' : "_,.!~*()@:+/\\");// jscs:ignore validateQuoteMarks
|
||||
|
||||
if (typeof text === 'string') {
|
||||
while (SCRIPT_REGEX.test(text)) {
|
||||
@ -74,18 +73,17 @@ module.exports = {
|
||||
ch = text.charAt(i);
|
||||
if (ch === ' ') {
|
||||
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);
|
||||
}
|
||||
}
|
||||
text = s.join('').trim();
|
||||
}
|
||||
return text;
|
||||
}, cloneTrim: function(from) {
|
||||
}, cloneTrim(from) {
|
||||
var _out = {};
|
||||
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) {
|
||||
|
||||
if (from.hasOwnProperty(key)) {
|
11
package.json
11
package.json
@ -1,11 +1,18 @@
|
||||
{
|
||||
"name": "md-utils",
|
||||
"version": "0.0.2",
|
||||
"version": "0.0.3",
|
||||
"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": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
},
|
||||
"author": "Martin Donnelly <martind2000@gmail.com>",
|
||||
"license": "ISC"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user