New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

textural-js

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

textural-js

A javascript library for formatting and manipulating text.

latest
npmnpm
Version
0.1.8
Version published
Maintainers
1
Created
Source

#textural.js# ##A javascript library for formatting and manipulating text.##

Build Status Coverage Status npm version

How to use it

In browser

<script src="textural.min.js"> </script>

In Node.js

npm install textural
var textural = require('textural');

Example

var sample = textural('sampleText').format('snake');
// 'sample_text'

Format
Text can be formatted to any known format such as camelCase, snake_case, slug-case, human case.

Note: you can use upper, lower and capitalize prefix for any kind of format, e.g uppersnake will produce: SNAKE_CASE

DescriptionFormatResult
convert to camelCasecamelexampleText
convert to snake_casesnakeexample_text
convert to slug-caseslugexample-text
convert to normal texthumanexample text
truncate letters (change number after t according to your needs)t3exa

Examples with prefix

FormatResult
uppersnakeEXAMPLE_TEXT
lowersnakeexample_text
capitalizesnakeExample_Text

Null handler (value to return if no text present)

Note: null handler should be set always at the end of format string, you can put any text you like inside parentheses and also it can be added to any type of format

FormatResult
(-)-
lowersnake(No value)No value

Use it with angular

1) Create custom angular filter

After library is included to your project we can create custom angular filter that we are planing to use later in html or in controlers

angular.module('myAngularApp')
.filter('text', function() {
    return function(input, format) {
        return textural(input).format(format);
    }
 });

2) Use it

$scope.myModel = 'exampleText'
in html
{{ myModel | text:'snake' }}
or in controler
$scope.test = $filter('text')($scope.myModel, 'snake');
will output
// example_text

http://ivanblazevic.github.io/textural-js/

The MIT License

Copyright (c) 2015 Ivan Blazevic

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Keywords

text

FAQs

Package last updated on 19 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts