Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

machinepack-strings

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

machinepack-strings - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

44

machines/capitalize.js

@@ -7,6 +7,6 @@ module.exports = {

description: 'Capitalize the first character of a string.',
description: 'Capitalize the first (or any) letter in a string.',
extendedDescription: 'If the first letter of the string is not a letter, it will be left as-is.',
extendedDescription: 'If the character at the specified position in a string is not a letter, it will be left as-is.',

@@ -21,7 +21,18 @@

inputs: {
string: {
example: 'guido villeriño',
friendlyName: 'String',
example: 'villeriño',
description: 'The string to capitalize.',
required: true
},
at: {
friendlyName: 'Which letter?',
description: 'The index of the letter to capitalize within the string',
extendedDescription: 'Strings are indexed starting from the left at 0.',
example: 0,
defaultsTo: 0
}
},

@@ -31,21 +42,32 @@

exits: {
success: {
friendlyName: 'then',
description: 'OK.',
example: 'Guido villeriño',
},
error: {
description: 'Unexpected error occurred.'
example: 'Villeriño',
}
},
defaultExit: 'success',
fn: function (inputs, exits) {
var _ = require('lodash');
// If a custom character index was NOT specified, just
// capitalize the string.
if (_.isUndefined(inputs.at)) {
return exits.success(
_.capitalize(inputs.string)
);
}
fn: function (inputs, exits) {
var _ = require('lodash');
return exits.success(_.capitalize(inputs.string));
// Otherwise, do some surgery:
return exits.success(
inputs.string.slice(0, inputs.at) +
inputs.string.slice(inputs.at, inputs.at+1).toUpperCase() +
inputs.string.slice(inputs.at+1)
);
}
};

@@ -7,3 +7,3 @@ module.exports = {

description: 'Convert uppercase letters to lowercase in the specified string.',
description: 'Convert all uppercase letters to lowercase in the specified string.',

@@ -10,0 +10,0 @@

@@ -7,3 +7,3 @@ module.exports = {

description: 'Convert lowercase letters to uppercase in the specified string.',
description: 'Convert all lowercase letters to uppercase in the specified string.',

@@ -10,0 +10,0 @@

{
"name": "machinepack-strings",
"version": "2.0.0",
"version": "2.1.0",
"description": "Work with strings.",

@@ -5,0 +5,0 @@ "scripts": {

@@ -11,3 +11,3 @@ <h1>

## Installation &nbsp; [![NPM version](https://badge.fury.io/js/machinepack-strings.svg)](http://badge.fury.io/js/machinepack-strings) [![Build Status](https://travis-ci.org/mikermcneil/machinepack-strings.png?branch=master)](https://travis-ci.org/mikermcneil/machinepack-strings)
## Installation &nbsp; [![NPM version](https://badge.fury.io/js/machinepack-strings.svg)](http://badge.fury.io/js/machinepack-strings) [![Build Status](https://travis-ci.org/treelinehq/machinepack-strings.png?branch=master)](https://travis-ci.org/treelinehq/machinepack-strings)

@@ -14,0 +14,0 @@ ```sh

@@ -5,7 +5,2 @@ {

{
"todo": true,
"using": {},
"outcome": "success"
},
{
"using": {

@@ -30,4 +25,27 @@ "string": "guido"

"returns": "---would you look at all those dashes?!!?"
},
{
"using": {
"string": "villeriño"
},
"outcome": "success",
"returns": "Villeriño"
},
{
"using": {
"string": "villeriño",
"at": "7"
},
"outcome": "success",
"returns": "villeriÑo"
},
{
"using": {
"string": "villeriño",
"at": "2"
},
"outcome": "success",
"returns": "viLleriño"
}
]
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc