Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rbarilani/parse-template-object

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rbarilani/parse-template-object

Parse objects that use templates as values (like grunt config)

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Parse Template Object

Parse objects that use templates as values (like grunt config). It's actually based/derived on grunt config mechanism.

Build Status

Install

npm install @rbarilani/parse-template-object --save

Usage


//
// Basic usage
//
var parse = require('@rbarilani/parse-template-object');

var object = {
    meta: { version: '1.1.0' },
    package: {
        name: 'awesome-<%= meta.version %>'
    },
    arr: ['foo', '<%= package.name %>']
};

console.log(parse(object));

// OUT:
//
// {
//     meta: { version: '1.1.0' },
//     package: {
//         name: 'awesome-1.1.0'
//     }
//     arr: ['foo', 'awesome-1.1.0']
// }
// ------------------------------------

//
// Add extra context with "imports" options
//
var object2 = {
    package: {
        name: 'awesome-<%= meta.version %>'
    },
    arr: ['foo', '<%= package.name %>']
};

var parsed2 = parse(object2, {
  imports: {
    meta: { version: '1.1.0'}
  }
});

console.log(parsed2);

// OUT:
//
// {
//     package: {
//         name: 'awesome-1.1.0'
//     }
//     arr: ['foo', 'awesome-1.1.0']
// }
// ------------------------------------

LICENSE

Copyright 2017 Ruben Barilani

Project is released under the MIT license. See LICENSE for details.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License

Keywords

FAQs

Package last updated on 11 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc