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

between-join

v1.5.4

Published

Join array between expression

Downloads

23

Readme

Between-Join

Join array between expression for NodeJS

What's this?

This is a simple library for generate string (of object or array)

Installation

Between-Join requires Node.js v8+ to run.

Install the dependencies and start the server.

$ cd yourProject
$ npm install between-join --save

Parameters

BetweenJoin must receive 3 parametters (2 required):
1) Object / Array [Required]
2) Expression [Required]
    - Expression must contain '$1' key, and/or $2 if is jsobject
      - Objects:
        - $1 = Object key
        - $2 = Object value
3) Delete [Optional]
    - Numeric param, erase last characters (1, ..., response.length)

Expression

Between-join must receive to parameter, 'expression'. The word '$1' into expression will be replaced by value of array and '$1' and '$2' for object

const exp = '>$1<';

Examples

Array

Code:

// Import
const BetweenJoin = require('between-join');
// Properties
// Array
const array = ['Hola', 'Mundo'];
// Expression
const expression = '[$1]';
// Response
const response = BetweenJoin(array, expression);
// Print
console.log(response);

Output

[Hello][World]

Object

Code:

// Import
const BetweenJoin = require('between-join');
// Properties
// Object
const obj = {
  hola: 'World',
  key: 'Value',
};
// Expression
const expression = '[$1-$2]';
// Response
const response = BetweenJoin(obj, expression);
// Print
console.log(response);

Output

[hola-World][key-Value]

Object and array

Code:

// Import
const BetweenJoin = require('between-join');
// Properties
// Array
const values = {
  array: ['Hello', 'World'],
  obj: {
    print: 'I\'m a js object',
  },
};
// Expression
const expression = '[$1 $2]';
// Response
const response = BetweenJoin(values, expression);
// Print
console.log(response);

Output

[array [Hello][World]][obj[printI'm a js object]]

Deleting last character

// Import
const BetweenJoin = require('between-join');
// Properties
// Array
const array = ['Hello', 'World'];
// Expression
const expression = '[$1]';
// Response
const normal = BetweenJoin(array, expression);
const one = BetweenJoin(array, expression, 1);
const two = BetweenJoin(array, expression, 2);
// Print
console.log(normal);
console.log(one);
console.log(two);

Output

[Hello][World]
[Hello][World
[Hello][Worl