npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ezs/strings

v1.0.5

Published

Plugin d'instructions ezs pour traiter des chaînes de caractères

Downloads

68

Readme

@ezs/strings

Des intructions pour manipuler des chaînes de caratères.

installation

npm install @ezs/core
npm install @ezs/strings

À mettre au début du script:

[use]
plugin = strings

usage

Table of Contents

decode

Decodes a given string using a provided mapping, replacing strings that match values (to)in the mapping with their corresponding keys (from). Optionally, a prefix and suffix can be set (they are removed too from strings).

This statement is the reverse of encode.

Input:

[{
    "id": "1",
    "value": "Flow control based inffivesup MW wind turbine",
}, {
    "id": "2",
    "value": "Motion Characteristics of infonesupinfzerosup MW Superconducting Floating Offshore Wind Turbine",
}]

Script:

[decode]
path = value
from = 1
to = one
from = 5
to = five
from = 0
to = zero
prefix = inf
suffix = sup

Output:

[{
    "id": "1",
    "value": "Flow control based 5 MW wind turbine",
}, {
    "id": "2",
    "value": "Motion Characteristics of 10 MW Superconducting Floating Offshore Wind Turbine",
}]

⚠ You must give as much from as to.

See encode.

Parameters

  • path string The path of the string to be decoded, within data.
  • from Array<string> An array of strings to replace with.
  • to Array<string> An array of strings to be replaced.
  • prefix string A string to be removed from the beginning of each replaced substring. (optional, default "")
  • suffix string A string to be removed from the end of each replaced substring. (optional, default "")

encode

Encodes a given string using a provided mapping, replacing characters that match keys in the mapping with their corresponding values. Optionally, a prefix and suffix can be added to the final result.

Input:

[{
    "id": "1",
    "value": "Flow control based 5 MW wind turbine",
}, {
    "id": "2",
    "value": "Motion Characteristics of 10 MW Superconducting Floating Offshore Wind Turbine",
}]

Script:

[encode]
path = value
from = 1
to = one
from = 5
to = five
from = 0
to = zero
prefix = inf
suffix = sup

Output:

[{
    "id": "1",
    "value": "Flow control based inffivesup MW wind turbine",
}, {
    "id": "2",
    "value": "Motion Characteristics of infonesupinfzerosup MW Superconducting Floating Offshore Wind Turbine",
}]

⚠ The replacements are made in the order of the from array. This means that if 1 is replaced with 2, and next 2 replaced with 3, a 1 is eventually replaced with 3.

⚠ You must give as much from as to.

See decode to invert the processus.

Parameters

  • path string The path of the string to be encoded, within data.
  • from Array<string> An array of strings to replace.
  • to Array<string> An array of strings to replace with.
  • prefix string A string to be added to the beginning of each replaced substring. (optional, default "")
  • suffix string A string to be added to the end of each replaced substring. (optional, default "")

inflection

Take a String and inflect it with or more transformers from this list pluralize, singularize, camelize, underscore, humanize, capitalize, dasherize, titleize, demodulize, tableize, classify, foreign_key, ordinalize

Input:

{ "id": 1, "value": "all job" }

Script:

[inflection]
path = value
transform = pluralize
transform = capitalize
transform = dasherize

Output:

{ "id": 1, "value": "All-jobs" }

📗 When the path is not given, the input data is considered as a string, allowing to apply inflection on a string stream.

see https://www.npmjs.com/package/inflection

Parameters

  • path string path of the field to segment (optional, default "")
  • transform string? name of a transformer

Returns Array<string>

sentences

Take a String and split it into an array of sentences.

Input:

{ "id": 1, "value": "First sentence? Second sentence. My name is Bond, J. Bond." }

Output:

{ "id": 1, "value": ["First sentence?", "Second sentence.", "My name is Bond, J. Bond."] }

📗 When the path is not given, the input data is considered as a string, allowing to apply inflection on a string stream.

Parameters

  • path string path of the field to segment (optional, default "")

Returns Array<string>