Skip to content

Instantly share code, notes, and snippets.

@mcshaman
mcshaman / parseCSV.js
Last active Mar 28, 2016
Light weight CSV paser function that works in old versions of JavaScript
View parseCSV.js
/**
* 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 Sep 23, 2015
Javascript function that converts alphabetical styled ordered list letters to number
View lettertonumber.js
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 Sep 23, 2015
Javascript function that converts roman numeral style ordered list strings to number
View romantonumber.js
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,