codestrings

package module
v0.0.0-...-80665e0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2022 License: MIT Imports: 2 Imported by: 0

README

# codestrings 🔤

strings but for your source code.

Extracts all the strings from your code.

Use Cases 🧑‍💻

  • Facilitate translation of hard-coded text strings
  • Quick glance at what a code is "saying" by looking at the strings within it (?)
  • NLP (?)

Features ⚡

  • Extract to json or csv
  • Multiple files at once
  • Single executable

So far, this has been only tested with Javascript.

Usage ⚙️

codestrings [parameters] file1,file2,file3,...

Parameters

  --delimiters
        delimiters to use for string extraction (comma separated and escaped) (default "\",',`")
  --output
        output type: json, csv (default "csv")

Examples 🧪

Let's say you have this javascript file called example.js.

function greet(name) {
  console.log(`Hello ${name}`);
}

var fname = "John";
const lname = "Doe";
let age = 42;
let address = {
  street: "123 Main St",
  city: "New York",
  state: "NY",
};

You can extract all the strings from this file with:

codestrings example.js

The output will be:

example.js,"Hello ${name}","John","Doe","123 Main St","New York","NY"

Roadmap 🛣️

  • Add more tests especially with more programming languages

  • Improve algorithm performance

License 📃

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractStrings

func ExtractStrings(source string, stringDelimiters []string) []string

Types

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

func NewScanner

func NewScanner(source string, delimitersMap map[string]struct{}) *Scanner

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL