Skip to content

Instantly share code, notes, and snippets.

@mcshaman
mcshaman / parseCSV.js
Last active March 28, 2016 09:25
Light weight CSV paser function that works in old versions of JavaScript
/**
* parseCSV
* Light weight CSV paser function that works in old versions of JavaScript
* @version 1.0.0
* @author McShaman
* @licence MIT
*/
(function(window) {
@mcshaman
mcshaman / lettertonumber.js
Created September 23, 2015 09:45
Javascript function that converts alphabetical styled ordered list letters to number
function letterToNumber( str ) {
var string = str.toUpperCase(),
length = string.length,
value,
number = 0;
// Validate string
if( ! string.match( /^[A-Z]+$/ ) ) {
@mcshaman
mcshaman / romantonumber.js
Last active September 23, 2015 09:47
Javascript function that converts roman numeral style ordered list strings to number
function romanToNumber( str ) {
var string = str.toUpperCase(),
letters = string.split( '' ),
length = letters.length,
i,
mapping = { I: 1, V: 5, X: 10, L: 50, C: 100, D: 500, M: 1000 },
values = [],
valueA,
valueB,