PHP Classes

File: public/js/tinymce/src/plugins/wordcount/src/main/js/text/StringMapper.js

Recommend this page to a friend!
  Classes of Abed Nego Ragil Putra   GoLavaCMS   public/js/tinymce/src/plugins/wordcount/src/main/js/text/StringMapper.js   Download  
File: public/js/tinymce/src/plugins/wordcount/src/main/js/text/StringMapper.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: GoLavaCMS
Publish content on Web pages with SEO support
Author: By
Last change:
Date: 6 years ago
Size: 1,254 bytes
 

Contents

Class file image Download
/** * StringMapper.js * * Released under LGPL License. * Copyright (c) 1999-2016 Ephox Corp. All rights reserved * * License: http://www.tinymce.com/license * Contributing: http://www.tinymce.com/contributing */ define( 'tinymce.plugins.wordcount.text.StringMapper', [ 'tinymce.plugins.wordcount.text.UnicodeData', 'tinymce.plugins.wordcount.alien.Arr' ], function (UnicodeData, Arr) { var SETS = UnicodeData.SETS; var OTHER = UnicodeData.characterIndices.OTHER; var getType = function (char) { var j, set, type = OTHER; var setsLength = SETS.length; for (j = 0; j < setsLength; ++j) { set = SETS[j]; if (set && set.test(char)) { type = j; break; } } return type; }; var memoize = function (func) { var cache = {}; return function (char) { if (cache[char]) { return cache[char]; } else { var result = func(char); cache[char] = result; return result; } }; }; var classify = function (string) { var memoized = memoize(getType); return Arr.map(string.split(''), memoized); }; return { classify: classify }; } );