This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Tiny tokenizer - https://gist.github.com/borgar/451393 | |
* @param {String} string - string to be tokenized | |
* @param {Object} parsers - { word:/\w+/, whitespace:/\s+/, punctuation:/[^\w\s]/ } | |
* @param {String} deftok - type to label tokens that are not classified with the above parsers | |
* @return {Array} - array of objects => [{ token:"this", type:"word" },{ token:" ", type:"whitespace" }, Object { token:"is", type:"word" }, ... ] | |
**/ | |
export const classifyTokens = (string, parsers, deftok) => { | |
string = (!string) ? '' : string; // if string is undefined, make it an empty string | |
if (typeof string !== 'string') { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// SKMultilineLabel.swift | |
// | |
// Created by Craig on 10/04/2015 | |
// Modified by Christopher Klapp on 11/21/2015 for line breaks \n for paragraphs | |
// Copyright (c) 2015 Interactive Coconut. All rights reserved. | |
// | |
/* USE: | |
(most component parameters have defaults) |