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

helper-cache

Package Overview
Dependencies
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

helper-cache - npm Package Compare versions

Comparing version 0.1.2 to 0.1.4

test/mocha.opts

65

index.js

@@ -14,2 +14,22 @@ /*!

/**
* Utility method to define getters.
*
* @param {Object} `obj`
* @param {String} `name`
* @param {Function} `getter`
* @return {Getter}
* @api private
*/
function defineGetter(obj, name, getter) {
Object.defineProperty(obj, name, {
configurable: false,
enumerable: false,
get: getter,
set: function() {}
});
}
/**
* ```js

@@ -26,3 +46,10 @@ * var Helpers = require('helper-cache');

function Helpers (options) {
this.options = options || {bindFunctions: false};
if (!(this instanceof Helpers)) {
return new Helpers(options);
}
options = options || {bindFunctions: false};
defineGetter(this, 'options', function () {
return options;
});
}

@@ -39,14 +66,16 @@

Helpers.prototype.set = function(key, fn) {
if (typeof key !== 'string') {
this.keyend(key);
} else {
if (this.options.bindFunctions) {
this[key] = _.bind(fn, this);
defineGetter(Helpers.prototype, 'set', function () {
return function (key, fn, thisArg) {
if (typeof key !== 'string') {
_.extend(this, key);
} else {
this[key] = fn;
if (this.options.bindFunctions) {
this[key] = _.bind(fn, thisArg || this);
} else {
this[key] = fn;
}
}
}
return this;
};
return this;
}.bind(this);
});

@@ -62,10 +91,12 @@

Helpers.prototype.get = function(key) {
if (!key) {
return this;
}
return this[key];
};
defineGetter(Helpers.prototype, 'get', function () {
return function(key) {
if (!key) {
return this;
}
return this[key];
}.bind(this);
});
module.exports = Helpers;
{
"name": "helper-cache",
"description": "Easily get and set helper functions to pass to any application or template engine.",
"version": "0.1.2",
"version": "0.1.4",
"homepage": "https://github.com/jonschlinkert/helper-cache",

@@ -38,10 +38,6 @@ "author": {

"keywords": [
"docs",
"documentation",
"generate",
"generator",
"markdown",
"templates",
"verb"
"cache",
"helpers",
"helper"
]
}
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