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

populater

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

populater

Cross platform string syntax for reliably extracting object data

  • 0.5.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source
  • Usage

** Basic

#+BEGIN_SRC javascript var populater = require('populater'); var data = { text: "World" };

var context = populater(data); context("Hello {{text}}!") // === "Hello World!";

var template = populater.template("Hello {{text}}!"); template.context(data) // === "Hello World!";

#+END_SRC

** Define a method

#+BEGIN_SRC javascript var populater = require('populater');

populater.method('keys', function() { return Object.keys(this); });

var data = { text: "World" }; var context = populater(data); context("keys()") // === ['text']; #+END_SRC

** Using an alternative context for methods

#+BEGIN_SRC javascript var populater = require('populater');

populater.method('keys', function() { return Object.keys(this); });

var data = { text: "World" }; var altCTX = { 'one': true, 'two': true, 'three': true, };

var context = populater(data, altCTX); context("keys()") // === ['one', 'two', 'three'];

var template = populater.template("keys()"); template.context(data, altCTX) // === ['one', 'two', 'three']; #+END_SRC

FAQs

Package last updated on 05 Oct 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