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

tiny-strings

v1.0.12

Published

Scrape Strings from Arrays and Objects.

Downloads

321

Readme

Tiny Strings

Scrape Strings from Arrays and Objects.

API

strings(arg, keys = false, skip = [])

Returns an Array of Strings extracted from arg

param  {Array} or {Object} to scrape
param  {Boolean} to include Object keys
param  {Array} Keys to skip scraping
return {Array} Array of Strings scraped from 'arg'

Example

Without keys

strings({...});

With keys

strings({...}, true);

Skipping keys

strings({...}, false/true, ["skippedKey1", "skippedKey2"]);

Testing

Tiny Strings has 100% code coverage with its tests.

------------------|---------|----------|---------|---------|-------------------
File              | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
------------------|---------|----------|---------|---------|-------------------
All files         |     100 |      100 |     100 |     100 |                  
 tiny-strings.cjs |     100 |      100 |     100 |     100 |                  
------------------|---------|----------|---------|---------|-------------------

Example

Input

import {strings} from "tiny-strings";
const extracted = strings([
	{
		"_id": "66897c0b5bb3f3bda598a7be",
		"index": 0,
		"guid": "57cc37b7-ea7b-4cf5-b07e-238a15cc1cdd",
		"isActive": true,
		"balance": "$1,290.80",
		"picture": "http://placehold.it/32x32",
		"age": 21,
		"eyeColor": "blue",
		"name": "Valeria Jenkins",
		"gender": "female",
		"company": "GEOLOGIX",
		"email": "[email protected]",
		"phone": "+1 (976) 597-3338",
		"address": "681 Jackson Place, Collins, Nevada, 8477",
		"about": "Officia sunt fugiat aute eiusmod cillum excepteur enim consectetur in pariatur consequat cupidatat. Id minim anim sint cupidatat nostrud labore esse proident eiusmod eu. Dolor sit aute adipisicing est proident eiusmod voluptate reprehenderit sunt aliquip non quis. Lorem voluptate laboris aliquip cupidatat.\r\n",
		"registered": "2016-04-05T01:14:10 +04:00",
		"latitude": 8.514373,
		"longitude": -22.578972,
		"tags": [
			"voluptate",
			"esse",
			"amet",
			"mollit",
			"in",
			"consectetur",
			"sunt"
		],
		"friends": [
			{
				"id": 0,
				"name": "Moore Howell"
			},
			{
				"id": 1,
				"name": "Summer Cline"
			},
			{
				"id": 2,
				"name": "Francis Simon"
			}
		],
		"greeting": "Hello, Valeria Jenkins! You have 1 unread messages.",
		"favoriteFruit": "banana"
	},
	{
		"_id": "66897c0b0eea9250887803d6",
		"index": 1,
		"guid": "6eac3134-b442-4289-a498-ef9b5624f196",
		"isActive": false,
		"balance": "$1,302.96",
		"picture": "http://placehold.it/32x32",
		"age": 28,
		"eyeColor": "brown",
		"name": "Amanda Rodgers",
		"gender": "female",
		"company": "GRAINSPOT",
		"email": "[email protected]",
		"phone": "+1 (987) 457-3247",
		"address": "650 Osborn Street, Edenburg, New Jersey, 1377",
		"about": "Eu minim enim aliquip nulla aliquip elit sit nostrud dolore reprehenderit aliquip sit qui Lorem. Enim et excepteur dolor velit minim nulla ullamco nisi. Qui adipisicing id occaecat nisi duis quis sint minim laborum minim id. Do id aliqua deserunt incididunt nulla officia nostrud reprehenderit laborum aliquip qui. Veniam pariatur eu quis reprehenderit velit nostrud deserunt deserunt. Commodo duis esse deserunt laborum tempor dolore anim laborum deserunt ipsum sit tempor consectetur.\r\n",
		"registered": "2023-05-27T09:39:08 +04:00",
		"latitude": 45.890773,
		"longitude": -29.059383,
		"tags": [
			"Lorem",
			"sunt",
			"cillum",
			"ea",
			"in",
			"aute",
			"culpa"
		],
		"friends": [
			{
				"id": 0,
				"name": "Jo Nunez"
			},
			{
				"id": 1,
				"name": "Mcdonald Burns"
			},
			{
				"id": 2,
				"name": "Pacheco Vang"
			}
		],
		"greeting": "Hello, Amanda Rodgers! You have 7 unread messages.",
		"favoriteFruit": "strawberry"
	}
]);

Output

[
	"66897c0b5bb3f3bda598a7be",
	"57cc37b7-ea7b-4cf5-b07e-238a15cc1cdd",
	"$1,290.80",
	"http://placehold.it/32x32",
	"blue",
	"Valeria Jenkins",
	"female",
	"GEOLOGIX",
	"[email protected]",
	"+1 (976) 597-3338",
	"681 Jackson Place, Collins, Nevada, 8477",
	"Officia sunt fugiat aute eiusmod cillum excepteur enim consectetur in pariatur consequat cupidatat. Id minim anim sint cupidatat nostrud labore esse proident eiusmod eu. Dolor sit aute adipisicing est proident eiusmod voluptate reprehenderit sunt aliquip non quis. Lorem voluptate laboris aliquip cupidatat.\r\n",
	"2016-04-05T01:14:10 +04:00",
	"voluptate",
	"esse",
	"amet",
	"mollit",
	"in",
	"consectetur",
	"sunt",
	"Moore Howell",
	"Summer Cline",
	"Francis Simon",
	"Hello, Valeria Jenkins! You have 1 unread messages.",
	"banana",
	"66897c0b0eea9250887803d6",
	"6eac3134-b442-4289-a498-ef9b5624f196",
	"$1,302.96",
	"http://placehold.it/32x32",
	"brown",
	"Amanda Rodgers",
	"female",
	"GRAINSPOT",
	"[email protected]",
	"+1 (987) 457-3247",
	"650 Osborn Street, Edenburg, New Jersey, 1377",
	"Eu minim enim aliquip nulla aliquip elit sit nostrud dolore reprehenderit aliquip sit qui Lorem. Enim et excepteur dolor velit minim nulla ullamco nisi. Qui adipisicing id occaecat nisi duis quis sint minim laborum minim id. Do id aliqua deserunt incididunt nulla officia nostrud reprehenderit laborum aliquip qui. Veniam pariatur eu quis reprehenderit velit nostrud deserunt deserunt. Commodo duis esse deserunt laborum tempor dolore anim laborum deserunt ipsum sit tempor consectetur.\r\n",
	"2023-05-27T09:39:08 +04:00",
	"Lorem",
	"sunt",
	"cillum",
	"ea",
	"in",
	"aute",
	"culpa",
	"Jo Nunez",
	"Mcdonald Burns",
	"Pacheco Vang",
	"Hello, Amanda Rodgers! You have 7 unread messages.",
	"strawberry"
]

License

Copyright (c) 2024 Jason Mulligan Licensed under the BSD-3 license.