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 🙏

© 2026 – Pkg Stats / Ryan Hefner

grunt-model-settings

v0.0.2

Published

Grunt plugin for loading and merge settings from grunt config file

Readme

grunt-model-settings

Grunt plugin for build models rules functions from json/yaml files

It can be used for named rules declarations of statuses, types and another unreadable or preset model attributes.

isWeekend:
  includeAny:                           Model.isWeekend = function () {
    dayOfWeekName:           ->             return (/^sat|^sun/i).test(this.dayOfWeekName);
      - '^sat'                          }
      - '^sun'
  • Usage Example
  • How to start
  • Advantage configuring
  • Recommendations

Usage Example

localSettings: {
    js: {
        options: {
            prefix: 'Model.prototype'
        },
        src:  [
            '*.{yaml,yml,json}'
        ],
        dest: 'build.js'
    }
};

options.prefix

Type: String Default value: ''

Namespace of your properties. Example: Model.prototype = { isWeekend: function () {...} };


How to start

Sample project structure

Installation
npm install grunt-model-settings --save-dev
1 Create the file(s) with rules definitions.

You can use single or many declarations per file. Example with logic at comments:

isWeekend:              # rule method name
  includeAny:           # list type (includeAny or excludeAny)
    - dayOfWeekName:    # attribute name
      - '^sat'          # attribute values as RegExp partial
      - '^sun'
    - dayOfWeek: '6'    
    - isSunday          # another method call
isSunday:
  includeAny:
    - dayOfWeek: 7
2 Add modelSettings section to your Grunfile

see Usage Example

3 Run task
grunt modelSettings
Result:
Model.prototype = {
    isWeekend: function () {
        return ((/^sat|^sun/i).test(this.attributes.dayOfWeekName) || (/6/i).test(this.attributes.dayOfWeek) || this.isSunday());
    },
    isSunday: function () {
        return ((/7/i).test(this.attributes.dayOfWeek));
    }
};
grunt.initConfig({
    concatProperties: {
        myApp: {
            options: {
                prefix:           'Model.prototype'
                singleDefinition: true,
                rulePrefix:       'function () {\n return ',
                rulePostfix:      ';\n}',
                functionsScope:   'this',
                attributesScope:  'this.attributes'
            },

            src:  [
                '*.{yaml,yml,json}'
            ],
            dest: 'build.js'
        }
    }
};

options.singleDefinition

Type: Boolean Default value: true

if true rules will be concated to object:

Model.prototype = {
    isWeekend: function () {...},
    isSunday:  function () {...}
};

if false rules will be defined as functions:

Model.prototype.isWeekend: function () {...};
Model.prototype.isSunday:  function () {...};

Set this attribute to false using grunt-concat-properties

options.rulePrefix

Type: String Default value: function () {\n return

String before rule body: isSunday: function () { return ((/7/i).test(this.attributes.dayOfWeek)); }

options.rulePostfix

Type: String Default value: ;\n}

String after rule body: isSunday: function () { return ((/7/i).test(this.attributes.dayOfWeek)); }

options.functionsScope

Type: String Default value: this

String before method call: isWeekend: function () { return this.isSunday(); }

options.attributesScope

Type: String Default value: this.attributes

String before attribute call: isSunday: function () { return ((/7/i).test(this.attributes.dayOfWeek)); }