at-variables

    0.0.1 • Public • Published

    at-variables

    Build Status npm version JavaScript Style Guide

    Extract at-variables from strings:

    const atVars = require('at-variables')
     
    const str = `
      @name John
      @age 20
      @skills.frontend html
      @skills.frontend css
      @skills.backend php
      @skills.backend java
    `
     
    const vars = atVars(str)
     
    console.log(vars)
     
    // {
    //   name: 'John',
    //   age: 20,
    //   skills: {
    //     frontend: ['html', 'css'],
    //     backend: ['php', 'java']
    //   }
    // }

    installation

    npm install at-variables --save

    requirements

    Node >= 6

    tests

    npm install && npm test

    usage

    atVariables(String) -> Object

    Extracts the variables from the string.

    atVariables.clear(String) -> String

    Removes the variables from the string:

    let str = `
    @key value
    my string
    `
     
    str = atVariables.clear(str)
     
    console.log(str)
    // "my string"

    license

    MIT

    Install

    npm i at-variables

    DownloadsWeekly Downloads

    3

    Version

    0.0.1

    License

    MIT

    Last publish

    Collaborators

    • avatar