summaryrefslogtreecommitdiff
path: root/node_modules/textr
diff options
context:
space:
mode:
author8cy <[email protected]>2020-04-03 02:48:28 -0700
committer8cy <[email protected]>2020-04-03 02:48:28 -0700
commitf9159ea2d994e14180fb02ab562f0119513e67cf (patch)
tree09d14cdf05456567156738b681379d4bccd64e5c /node_modules/textr
parent2020/04/03, 02:42, V1.2.1 (diff)
downloads5nical-f9159ea2d994e14180fb02ab562f0119513e67cf.tar.xz
s5nical-f9159ea2d994e14180fb02ab562f0119513e67cf.zip
2020/04/03, 02:47, V1.2.2
Diffstat (limited to 'node_modules/textr')
-rw-r--r--node_modules/textr/.jshintrc17
-rw-r--r--node_modules/textr/.npmignore7
-rw-r--r--node_modules/textr/.travis.yml7
-rw-r--r--node_modules/textr/history.md19
-rw-r--r--node_modules/textr/index.js108
-rw-r--r--node_modules/textr/package.json76
-rw-r--r--node_modules/textr/readme.md135
-rw-r--r--node_modules/textr/test/bench.js65
-rw-r--r--node_modules/textr/test/index.js130
-rw-r--r--node_modules/textr/test/support.js28
10 files changed, 0 insertions, 592 deletions
diff --git a/node_modules/textr/.jshintrc b/node_modules/textr/.jshintrc
deleted file mode 100644
index e61ba01..0000000
--- a/node_modules/textr/.jshintrc
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "browser": false,
- "curly": true,
- "expr": true,
- "indent": false,
- "jquery": false,
- "laxcomma": true,
- "laxbreak": true,
- "maxcomplexity": 10,
- "maxdepth": 3,
- "maxparams": 4,
- "node": true,
- "trailing": true,
- "quotmark": "single",
- "strict": true,
- "undef": true
-}
diff --git a/node_modules/textr/.npmignore b/node_modules/textr/.npmignore
deleted file mode 100644
index b6894e6..0000000
--- a/node_modules/textr/.npmignore
+++ /dev/null
@@ -1,7 +0,0 @@
-# Folder view configuration files
-.DS_Store
-._*
-node_modules
-npm-debug.log
-index.es5.js
-coverage
diff --git a/node_modules/textr/.travis.yml b/node_modules/textr/.travis.yml
deleted file mode 100644
index 4b40d02..0000000
--- a/node_modules/textr/.travis.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-language: node_js
-node_js:
- - "0.10"
- - "0.12"
- - "iojs"
-after_script:
- - npm run coveralls
diff --git a/node_modules/textr/history.md b/node_modules/textr/history.md
deleted file mode 100644
index 36d30e7..0000000
--- a/node_modules/textr/history.md
+++ /dev/null
@@ -1,19 +0,0 @@
-0.2.2 / 2015-04-18
-==================
-
-* add support to use `String.prototype` methods as transform functions
-
-0.2.1 / 2015-04-16
-==================
-
-* add forgotten fields in package.json
-
-0.2.0 / 2015-04-16
-==================
-
-* improve readme
-* improve tests
-* improve jsdocs
-* add options support
-* refactor api
-* expose `tf.exec` method
diff --git a/node_modules/textr/index.js b/node_modules/textr/index.js
deleted file mode 100644
index 2f5b925..0000000
--- a/node_modules/textr/index.js
+++ /dev/null
@@ -1,108 +0,0 @@
-'use strict';
-
-/**
- * Create new transform function
- *
- * @constructor
- * @return {object:{exec:fn,use:fn}}
- * @return {fn:exec}
- * @api public
- */
-module.exports = function textr(defaults) {
-
- /**
- * list of registred middlewares
- * @api public
- */
- var mws = [];
-
- /**
- * Default options will be passed to either of the middlewares as second param.
- * You can redefine props by passing your options to `tf.exec()` as second arg.
- * @api private
- */
- defaults = defaults || {};
-
- /**
- * expose public interface of the textr
- *
- * @example
- *
- * // functional style
- * text = textr()
- * // register plugins
- * .use(quotes)
- * .use(capitalize)
- * .exec(text)
- *
- * // save transformer to reuse
- * tf = textr()
- * // register plugins
- * .use(quotes, elipses, capitalize)
- * ;
- * return ['Hello', 'world'].map(tf);
- *
- * @constructor
- * @alias exec
- */
- function api() {
- return exec.apply(null, arguments);
- }
-
- /**
- * Expose `exec`, `use` and `mws` as properties
- * of the `api`
- *
- * @alias exec
- * @alias use
- * @alias mws
- */
- api.exec = exec;
- api.use = use;
- api.mws = mws;
-
- return api;
-
- /**
- * process given text by the middlewares
- * @param {string} text
- * @param {Object} options Options to merge with defaults
- * @return {string} text
- * @api public
- */
- function exec(text, options) {
- options = clone(defaults, options);
- var l = mws.length;
- for (var i = 0; i < l; i++) {
- text = mws[i].apply(text, [text, options]) || text;
- }
- return text;
- }
-
- /**
- * Register either middleware and array of middlewares
- * @param {...fn} ...middlewares
- * @return {api}
- * @api public
- */
- function use() {
- [].push.apply(mws, arguments);
- return api;
- }
-
-};
-
-/**
- * merge given objects to new one. Returns clone
- * @param {Object} ...objects Objects to clone into the one new
- * @return {Object}
- */
-function clone() {
- var res = {};
- var length = arguments.length;
- for (var i = 0; i < length; i++) {
- var obj = arguments[i];
- for (var k in obj) { res[k] = obj[k]; }
- }
- return res;
-}
diff --git a/node_modules/textr/package.json b/node_modules/textr/package.json
deleted file mode 100644
index 8c4c5f6..0000000
--- a/node_modules/textr/package.json
+++ /dev/null
@@ -1,76 +0,0 @@
-{
- "_from": "textr@^0.3.0",
- "_id": "[email protected]",
- "_inBundle": false,
- "_integrity": "sha1-cXNhKGlirI3za3omGft3OhW5t/c=",
- "_location": "/textr",
- "_phantomChildren": {},
- "_requested": {
- "type": "range",
- "registry": true,
- "raw": "textr@^0.3.0",
- "name": "textr",
- "escapedName": "textr",
- "rawSpec": "^0.3.0",
- "saveSpec": null,
- "fetchSpec": "^0.3.0"
- },
- "_requiredBy": [
- "/at-quotes"
- ],
- "_resolved": "https://registry.npmjs.org/textr/-/textr-0.3.0.tgz",
- "_shasum": "717361286962ac8df36b7a2619fb773a15b9b7f7",
- "_spec": "textr@^0.3.0",
- "_where": "E:\\Documents\\GitHub\\s5nical\\node_modules\\at-quotes",
- "author": {
- "name": "Anton Shuvalov",
- "email": "[email protected]"
- },
- "bugs": {
- "url": "https://github.com/shuvalov-anton/textr/issues"
- },
- "bundleDependencies": false,
- "deprecated": false,
- "description": "Tiny and extendable text transforming framework",
- "devDependencies": {
- "commander": "^2.7.1",
- "coveralls": "^2.11.2",
- "istanbul": "^0.3.11",
- "mocha": "^2.2.4",
- "mocha-lcov-reporter": "0.0.2",
- "should": "^5.2.0"
- },
- "homepage": "http://shuvalov-anton.github.io/textr/",
- "keywords": [
- "typographic",
- "textr",
- "transformer",
- "text"
- ],
- "license": "MIT",
- "main": "index.js",
- "maintainers": [
- {
- "name": "Anton Shuvalov",
- "email": "[email protected]"
- },
- {
- "name": "Vladimir Starkov",
- "email": "[email protected]",
- "url": "http://vstarkov.com/"
- }
- ],
- "name": "textr",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/shuvalov-anton/textr.git"
- },
- "scripts": {
- "coverage": "istanbul cover _mocha",
- "coveralls": "coveralls < coverage/lcov.info",
- "precoveralls": "npm run coverage",
- "tdd": "npm test -- --watch",
- "test": "mocha"
- },
- "version": "0.3.0"
-}
diff --git a/node_modules/textr/readme.md b/node_modules/textr/readme.md
deleted file mode 100644
index 697acb5..0000000
--- a/node_modules/textr/readme.md
+++ /dev/null
@@ -1,135 +0,0 @@
-# textr
-
-[![NPM version][npm-image]][npm-url]
-[![Build Status][travis-image]][travis-url]
-[![Coveralls Status][coveralls-image]][coveralls-url]
-[![Dependency Status][depstat-image]][depstat-url]
-[![DevDependency Status][depstat-dev-image]][depstat-dev-url]
-
-> Textr is simple framework to compose text transformation functions
-
-Textr is good instrument to create modular tools to [make your typography better][bad-habits].
-It can compose any functions that get text, transform it and return result of
-processing. For example, check out few: [typographic-quotes][typographic-quotes],
-[typographic-math-symbols][typographic-math-symbols],
-[typographic-em-dashes][typographic-em-dashes] and [typographic-ellipses][typographic-ellipses].
-
-Plugins are available on npm, labelled with [textr][textr-npm]
-keyword. Also you can easily create new one. Don’t be scared.
-
-## Idea behind textr
-
-Typography for everybody! At the same time it’s impossible to create one ideal
-typographic engine. It doesn’t work this way. What we can do with it? We can
-easily create and maintain small, simple, full-tested and single responsible
-modules. After this we can compose bunch of these well done modules for every
-specific situation we need, and everybody will be happy with it’s
-own ideal text transformer.
-
-## Install
-
-```
-npm install --save textr
-```
-
-
-## Usage
-
-```js
-var textr = require('textr');
-var ellipses = require('typographic-ellipses');
-var spaces = require('typographic-single-spaces');
-var quotes = require('typographic-quotes');
-
-// Create new text transformer by compose yours
-tf = textr({ locale: 'ru'})
- .use(ellipses)
- .use(spaces)
- .use(quotes)
- .use(String.prototype.trim)
-;
-
-// then just send some text to the transformer
-tf('Hello "world"...\n'); // Hello «world»…
-```
-
-## API
-
-### textr(defaults)
-
-Create new textr transform function (`tf`). You can pass default options when
-create new transform stack.
-
-
-### tf.use(...fn)
-
-Register transform function as `tf` middleware.
-
-### tf.exec(text, options)
-
-Process given text by the middlewares.
-
-### tf(text)
-
-Identical to `tf.exec(text)`. This alias makes `tf` just regular transform
-function, that you can register as middleware for `textr` as well.
-
-```js
-var typorgapher = textr().use(typography, tools, here)
-var autocorrector = textr().use(autocorrection, things)
-var smiles = textr().use(text, to, smiles, goodies)
-
-var tf = textr()
- .use(typographer)
- .use(autocorrector)
- .use(smiles)
-;
-
-tf(text); // oh, that's awesome!11
-
-```
-
-
-## Plugins API
-
-Each plugin will be called with 2 arguments: `text` and `options`
-setted on `textr()`.
-
-```
-function plugin(text, options) {
- console.log(options); // { locale: 'ru' }
- return text;
-}
-```
-
-To support `String.prototype` methods as transformation functions, `this` value
-is equal to the `text`.
-
-
-## License
-
-[textr-npm]: https://www.npmjs.com/browse/keyword/textr
-
-MIT © [Shuvalov Anton](http://shuvalov.info), [Vladimir Starkov](http://github.com/matmuchrapna)
-
-[bad-habits]: http://practicaltypography.com/typewriter-habits.html
-
-[npm-url]: https://npmjs.org/package/textr
-[npm-image]: http://img.shields.io/npm/v/textr.svg
-
-[travis-url]: https://travis-ci.org/shuvalov-anton/textr
-[travis-image]: http://img.shields.io/travis/shuvalov-anton/textr.svg
-
-[coveralls-url]: https://coveralls.io/r/shuvalov-anton/textr
-[coveralls-image]: http://img.shields.io/coveralls/shuvalov-anton/textr.svg
-
-[depstat-url]: https://david-dm.org/shuvalov-anton/textr
-[depstat-image]: https://david-dm.org/shuvalov-anton/textr.svg
-
-[depstat-dev-url]: https://david-dm.org/shuvalov-anton/textr
-[depstat-dev-image]: https://david-dm.org/shuvalov-anton/textr/dev-status.svg
-
-[typographic-quotes]: https://github.com/matmuchrapna/typographic-quotes
-[typographic-math-symbols]: https://github.com/matmuchrapna/typographic-math-symbols
-[typographic-em-dashes]: https://github.com/matmuchrapna/typographic-em-dashes
-[typographic-ellipses]: https://github.com/matmuchrapna/typographic-ellipses
diff --git a/node_modules/textr/test/bench.js b/node_modules/textr/test/bench.js
deleted file mode 100644
index 9907e14..0000000
--- a/node_modules/textr/test/bench.js
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/usr/bin/env node
-
-'use strict';
-
-// dependencies
-var textr = require('../');
-var program = require('commander');
-var pkg = require('../package');
-
-/**
- * Simple benchmark which can be used as CLI in the future.
- *
- * @example
- *
- * $ echo 'hello "world"' > test
- * $ cat test | bench.js -t typographic-single-spaces,typographic-quotes
- *
- * hello "world"
- * 1654434 cycles per second%
- *
- *
- *
- */
-program
- .version(pkg.version)
- .option('-c, --cycles', 'create new tf on every cycle')
- .option('-t, --transforms [modules]', 'add transform functions to the bench')
-;
-
-program.parse(process.argv);
-
-var tfs = [];
-if (program.transforms) {
- tfs = program.transforms
- .split(',')
- .map(function(tf) {
- return require(tf);
- });
-}
-
-var buf = '';
-
-process.stdin.setEncoding('utf8');
-process.stdin.on('data', function(chunk) {
- buf += chunk;
-});
-process.stdin.on('end', bench);
-
-
-function bench() {
- var res;
- var startedAt = +new Date();
- var endedAt = startedAt + 1000;
- var i = 0;
- var tf;
- if (!program.cycles) { tf = textr().use.apply(null, tfs); }
- do {
- if (program.cycles) { tf = textr().use.apply(null, tfs); }
- res = tf(buf);
- i++;
- } while (+new Date() < endedAt);
- process.stdout.write(res);
- process.stdout.write('\r\n');
- process.stdout.write(i + ' cycles per second');
-}
diff --git a/node_modules/textr/test/index.js b/node_modules/textr/test/index.js
deleted file mode 100644
index c9a308e..0000000
--- a/node_modules/textr/test/index.js
+++ /dev/null
@@ -1,130 +0,0 @@
-/* global describe, it, before, navigator */
-
-'use strict';
-
-var textr = require('..');
-var should = require('should');
-var noop = require('./support').noop;
-var capitalize = require('./support').capitalize;
-var headline = require('./support').headline;
-
-describe('textr', function() {
-
- describe('api', function() {
-
- it('should register transformers', function() {
- var tf = textr();
- tf.should.have.property('use');
- tf.use.should.be.a.Function;
- });
-
- it('should process text', function() {
- var tf = textr();
- tf.should.be.a.Function;
- tf.should.have.property('exec');
- tf.exec.should.be.a.Function;
- tf('hello').should.be.equal('hello');
- });
-
- });
-
- describe('use', function() {
-
- it('should return transformer', function() {
- var tf = textr().use(noop);
- tf.should.be.a.Function;
- tf.use.should.be.a.Function;
- });
-
- it('should use plugins', function() {
- textr()
- .use(noop, noop)
- .use(noop)
- .mws.should.has.length(3)
- ;
- });
-
- it('should use itself as transform', function() {
- var one = textr()
- .use(capitalize)
- ;
- var two = textr()
- .use(headline(1))
- ;
- var tf = textr()
- .use(one, two)
- .exec('hello world')
- .should.be.equal('<h1>Hello World</h1>')
- ;
- });
-
- it('should support string.prototype methods', function() {
- var tf = textr()
- .use(String.prototype.trim)
- ;
- tf('text\t\n').should.be.equal('text');
- });
-
- });
-
- describe('exec', function() {
-
- it('should apply transformers to given text', function() {
- textr()
- .use(capitalize)
- .exec('hello world')
- .should.be.equal('Hello World')
- ;
- });
-
- it('should apply transformers with order of registration', function() {
- textr()
- .use(capitalize)
- .use(headline(1))
- .exec('hello world')
- .should.be.equal('<h1>Hello World</h1>')
- ;
- });
-
- it('should not miss text if on of the middlewares return falsy', function() {
- textr()
- .use(function (text, ctx) {
- // define mw that not transforming text;
- if ('undefined' === typeof navigator) { return; }
- ctx.locale = navigator.locale;
- })
- .exec('some text')
- .should.be.equal('some text')
- ;
- });
-
- it('should support options to correct recursive usage', function() {
- var pluginWithDefaultOptions = textr({ locale: 'ru', ownprop: true })
- .use(function(text, options) {
- options.locale.should.be.equal('en-us');
- options.direction.should.be.equal('ltr');
- options.ownprop.should.be.equal(true);
- options.other.should.be.equal('redefine');
- })
- ;
- var tf = textr({ locale: 'en-us', direction: 'ltr', other: 'param' })
- .use(pluginWithDefaultOptions)
- .exec('text', { other: 'redefine' })
- ;
- });
- });
-
- describe('options', function() {
- it('should pass options through each middleware', function() {
- textr({ locale: 'ru' })
- .use(function(text, opts) {
- return text + opts.locale;
- })
- .exec('locale: ')
- .should.be.equal('locale: ru')
- ;
- });
- });
-
-
-});
diff --git a/node_modules/textr/test/support.js b/node_modules/textr/test/support.js
deleted file mode 100644
index a530253..0000000
--- a/node_modules/textr/test/support.js
+++ /dev/null
@@ -1,28 +0,0 @@
-'use strict';
-
-/**
- * Convert text to capitalized string
- * @param {String} text
- * @return {String}
- */
-exports.capitalize = function(text) {
- return text.replace(/\b(.{1})/g, function (l) {
- return l.toUpperCase();
- });
-};
-
-/**
- * Wrap text by html headline with given level
- * @param {Number} level
- * @return {Function}
- */
-exports.headline = function(level) {
- return function(text) {
- return '<h' + level + '>' + text + '</h' + level + '>';
- };
-};
-
-/**
- * noop function
- */
-exports.noop = function() {};