pax_global_header00006660000000000000000000000064132573252650014524gustar00rootroot0000000000000052 comment=e374718580e927e7944234b136f233f00cc06f97 base-3.0.0/000077500000000000000000000000001325732526500124365ustar00rootroot00000000000000base-3.0.0/.editorconfig000066400000000000000000000004411325732526500151120ustar00rootroot00000000000000# http://editorconfig.org/ root = true [*] charset = utf-8 end_of_line = lf indent_size = 2 indent_style = space insert_final_newline = true trim_trailing_whitespace = true [{**/{actual,fixtures,expected,templates}/**,*.md}] trim_trailing_whitespace = false insert_final_newline = false base-3.0.0/.eslintrc.json000066400000000000000000000067751325732526500152510ustar00rootroot00000000000000{ "env": { "browser": false, "es6": true, "node": true, "mocha": true }, "globals": { "document": false, "navigator": false, "window": false }, "rules": { "accessor-pairs": 2, "arrow-spacing": [2, { "before": true, "after": true }], "block-spacing": [2, "always"], "brace-style": [2, "1tbs", { "allowSingleLine": true }], "comma-dangle": [2, "never"], "comma-spacing": [2, { "before": false, "after": true }], "comma-style": [2, "last"], "constructor-super": 2, "curly": [2, "multi-line"], "dot-location": [2, "property"], "eol-last": 2, "eqeqeq": [2, "allow-null"], "generator-star-spacing": [2, { "before": true, "after": true }], "handle-callback-err": [2, "^(err|error)$" ], "indent": [2, 2, { "SwitchCase": 1 }], "key-spacing": [2, { "beforeColon": false, "afterColon": true }], "keyword-spacing": [2, { "before": true, "after": true }], "new-cap": [2, { "newIsCap": true, "capIsNew": false }], "new-parens": 2, "no-array-constructor": 2, "no-caller": 2, "no-class-assign": 2, "no-cond-assign": 2, "no-const-assign": 2, "no-control-regex": 2, "no-debugger": 2, "no-delete-var": 2, "no-dupe-args": 2, "no-dupe-class-members": 2, "no-dupe-keys": 2, "no-duplicate-case": 2, "no-empty-character-class": 2, "no-eval": 2, "no-ex-assign": 2, "no-extend-native": 2, "no-extra-bind": 2, "no-extra-boolean-cast": 2, "no-extra-parens": [2, "functions"], "no-fallthrough": 2, "no-floating-decimal": 2, "no-func-assign": 2, "no-implied-eval": 2, "no-inner-declarations": [2, "functions"], "no-invalid-regexp": 2, "no-irregular-whitespace": 2, "no-iterator": 2, "no-label-var": 2, "no-labels": 2, "no-lone-blocks": 2, "no-mixed-spaces-and-tabs": 2, "no-multi-spaces": 2, "no-multi-str": 2, "no-multiple-empty-lines": [2, { "max": 1 }], "no-native-reassign": 0, "no-negated-in-lhs": 2, "no-new": 2, "no-new-func": 2, "no-new-object": 2, "no-new-require": 2, "no-new-wrappers": 2, "no-obj-calls": 2, "no-octal": 2, "no-octal-escape": 2, "no-proto": 0, "no-redeclare": 2, "no-regex-spaces": 2, "no-return-assign": 2, "no-self-compare": 2, "no-sequences": 2, "no-shadow-restricted-names": 2, "no-spaced-func": 2, "no-sparse-arrays": 2, "no-this-before-super": 2, "no-throw-literal": 2, "no-trailing-spaces": 0, "no-undef": 2, "no-undef-init": 2, "no-unexpected-multiline": 2, "no-unneeded-ternary": [2, { "defaultAssignment": false }], "no-unreachable": 2, "no-unused-vars": [2, { "vars": "all", "args": "none" }], "no-useless-call": 0, "no-with": 2, "one-var": [0, { "initialized": "never" }], "operator-linebreak": [0, "after", { "overrides": { "?": "before", ":": "before" } }], "padded-blocks": [0, "never"], "quotes": [2, "single", "avoid-escape"], "radix": 2, "semi": [2, "always"], "semi-spacing": [2, { "before": false, "after": true }], "space-before-blocks": [2, "always"], "space-before-function-paren": [2, "never"], "space-in-parens": [2, "never"], "space-infix-ops": 2, "space-unary-ops": [2, { "words": true, "nonwords": false }], "spaced-comment": [0, "always", { "markers": ["global", "globals", "eslint", "eslint-disable", "*package", "!", ","] }], "use-isnan": 2, "valid-typeof": 2, "wrap-iife": [2, "any"], "yoda": [2, "never"] } } base-3.0.0/.gitattributes000066400000000000000000000002001325732526500153210ustar00rootroot00000000000000# Enforce Unix newlines * text eol=lf # binaries *.ai binary *.psd binary *.jpg binary *.gif binary *.png binary *.jpeg binary base-3.0.0/.gitignore000066400000000000000000000004561325732526500144330ustar00rootroot00000000000000# always ignore files *.DS_Store .idea .vscode *.sublime-* # test related, or directories generated by tests test/actual actual coverage .nyc* # npm node_modules npm-debug.log # yarn yarn.lock yarn-error.log # misc _gh_pages _draft _drafts bower_components vendor temp tmp TODO.md package-lock.jsonbase-3.0.0/.npmrc000066400000000000000000000000221325732526500135500ustar00rootroot00000000000000package-lock=falsebase-3.0.0/.travis.yml000066400000000000000000000001461325732526500145500ustar00rootroot00000000000000sudo: false os: - linux - osx language: node_js node_js: - node - '9' - '8' - '7' - '6' base-3.0.0/.verb.md000066400000000000000000000154531325732526500140040ustar00rootroot00000000000000

# {%= name %} {%= badge("npm") %} {%= badge('downloads') %} {%= ifExists(["test", "test.js"], badge('travis')) %} {%= badge('gitter') %} ## Table of contents
Table of contents
About ## Why use Base? Base is a foundation for creating modular, unit testable and highly pluggable server-side node.js APIs. * Go from zero to working application within minutes * Use [community plugins](https://www.npmjs.com/browse/keyword/baseplugin) to add feature-functionality to your application * Create your own custom plugins to add features * Like building blocks, plugins are stackable. Allowing you to build [sophisticated applications](#toolkit-suite) from simple plugins. Moreover, those applications can also be used as plugins themselves. Most importantly, once you learn Base, you will be familiar with the core API of all applications built on Base. This means you will not only benefit as a developer, but as a user as well. ### Guiding principles The core team follows these principles to help guide API decisions: - **Compact API surface**: The smaller the API surface, the easier the library will be to learn and use. - **Easy to extend**: Implementors can use any npm package, and write plugins in pure JavaScript. If you're building complex apps, Base dramatically simplifies inheritance. - **Easy to test**: No special setup should be required to unit test `Base` or base plugins - **100% Node.js core style** * No API sugar (left for higher level projects) * Written in readable vanilla JavaScript ### Minimal API surface [The API](#api) was designed to provide only the minimum necessary functionality for creating a useful application, with or without [plugins](#plugins). **Base core** Base itself ships with only a handful of [useful methods](#api), such as: - `.set`: for setting values on the instance - `.get`: for getting values from the instance - `.has`: to check if a property exists on the instance - `.define`: for setting non-enumerable values on the instance - `.use`: for adding plugins **Be generic** When deciding on method to add or remove, we try to answer these questions: 1. Will all or most Base applications need this method? 1. Will this method encourage practices or enforce conventions that are beneficial to implementors? 1. Can or should this be done in a plugin instead? ### Composability **Plugin system** It couldn't be easier to extend Base with any features or custom functionality you can think of. Base plugins are just functions that take an instance of `Base`: ```js var base = new Base(); function plugin(base) { // do plugin stuff, in pure JavaScript } // use the plugin base.use(plugin); ``` Add "smart plugin" functionality with the [base-plugins][] plugin. **Inheritance** Easily inherit Base using `.extend`: ```js var Base = require('{%= name %}'); function MyApp() { Base.call(this); } Base.extend(MyApp); var app = new MyApp(); app.set('a', 'b'); app.get('a'); //=> 'b'; ``` **Inherit or instantiate with a namespace** By default, the `.get`, `.set` and `.has` methods set and get values from the root of the `base` instance. You can customize this using the `.namespace` method exposed on the exported function. For example: ```js var Base = require('{%= name %}'); // get and set values on the `base.cache` object var base = Base.namespace('cache'); var app = base(); app.set('foo', 'bar'); console.log(app.cache.foo); //=> 'bar' ```
## Install **NPM** ## Install {%= include("install-npm", {save: true}) %} **yarn** Install with [yarn](yarnpkg.com): ```sh $ yarn add base && yarn upgrade ``` ## Usage ```js var Base = require('base'); var app = new Base(); // set a value app.set('foo', 'bar'); console.log(app.foo); //=> 'bar' // register a plugin app.use(function() { // do stuff (see API docs for ".use") }); ``` ## API {%= apidocs("index.js") %} ## cache object **Cache** User-defined properties go on the `cache` object. This keeps the root of the instance clean, so that only reserved methods and properties on the root. ```js Base { cache: {} } ``` You can pass a custom object to use as the `cache` as the first argument to the `Base` class when instantiating. ```js const myObject = {}; const Base = require('base'); const base = new Base(myObject); ``` ## Toolkit suite Base is part of the [Toolkit suite](https://github.com/node-toolkit/getting-started) of applications. ### What is Toolkit? Toolkit is a collection of node.js libraries, applications and frameworks for helping developers quickly create high quality node.js applications, web projects, and command-line experiences. There are many other libraries on NPM for handling specific tasks, Toolkit provides the _systems_ and _building blocks_ for creating higher level workflows and processes around those libraries. Toolkit can be used to create a static site generator, blog framework, documentaton system, command line, task or plugin runner, and more! **Building Blocks** The following libraries can be used as "building blocks" for creating modular applications. - [base][]: (you are here!) framework for rapidly creating high quality node.js applications, using plugins like building blocks. Base serves as the foundation for several other applications in the [Toolkit suite](https://github.com/node-toolkit/getting-started). - [templates][]: Render templates with any node.js template engine, create and manage template collections. Use helpers, layouts, partials, includes... - [enquirer][]: Plugin-based prompt system for creating highly customizable command line experiences. - [composer][]: Plugin-based, async task runner. **Lifecycle Applications** The following applications provide workflows and automation for common phases of the software development lifecycle. Each of these tools can be used entirely standalone or bundled together. - [generate][]: create projects - [assemble][]: build projects - [verb][]: document projects - [update][]: maintain projects ## About ### Related projects {%= related(verb.related.list) %} ### Tests {%= include("tests") %} ### Contributing {%= include("contributing") %} If Base doesn't do what you need, [please let us know](../../issues). ### Release History See the [changelog](CHANGELOG.md); ### Authors **Jon Schlinkert** * [github/jonschlinkert](https://github.com/jonschlinkert) * [twitter/jonschlinkert](http://twitter.com/jonschlinkert) **Brian Woodward** * [github/doowb](https://github.com/doowb) * [twitter/doowb](http://twitter.com/doowb) ### License {%= copyright() %} {%= license %} *** {%= include("footer") %} {%= reflinks(verb.reflinks) %} base-3.0.0/LICENSE000066400000000000000000000021001325732526500134340ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) 2015-2017, Jon Schlinkert. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. base-3.0.0/README.md000066400000000000000000000404271325732526500137240ustar00rootroot00000000000000

# base [![NPM version](https://img.shields.io/npm/v/base.svg?style=flat)](https://www.npmjs.com/package/base) [![NPM monthly downloads](https://img.shields.io/npm/dm/base.svg?style=flat)](https://npmjs.org/package/base) [![Build Status](https://img.shields.io/travis/node-base/base.svg?style=flat)](https://travis-ci.org/node-base/base) [![Gitter](https://badges.gitter.im/join_chat.svg)](https://gitter.im/node-base/base)
Table of contents - [Why use Base?](#why-use-base) * [Guiding principles](#guiding-principles) * [Minimal API surface](#minimal-api-surface) * [Composability](#composability) - [Install](#install) - [Install](#install-1) - [Usage](#usage) - [API](#api) - [cache object](#cache-object) - [Toolkit suite](#toolkit-suite) * [What is Toolkit?](#what-is-toolkit) - [About](#about) * [Related projects](#related-projects) * [Tests](#tests) * [Contributing](#contributing) * [Release History](#release-history) * [Authors](#authors) * [License](#license)
About ## Why use Base? Base is a foundation for creating modular, unit testable and highly pluggable server-side node.js APIs. * Go from zero to working application within minutes * Use [community plugins](https://www.npmjs.com/browse/keyword/baseplugin) to add feature-functionality to your application * Create your own custom plugins to add features * Like building blocks, plugins are stackable. Allowing you to build [sophisticated applications](#toolkit-suite) from simple plugins. Moreover, those applications can also be used as plugins themselves. Most importantly, once you learn Base, you will be familiar with the core API of all applications built on Base. This means you will not only benefit as a developer, but as a user as well. ### Guiding principles The core team follows these principles to help guide API decisions: * **Compact API surface**: The smaller the API surface, the easier the library will be to learn and use. * **Easy to extend**: Implementors can use any npm package, and write plugins in pure JavaScript. If you're building complex apps, Base dramatically simplifies inheritance. * **Easy to test**: No special setup should be required to unit test `Base` or base plugins * **100% Node.js core style** - No API sugar (left for higher level projects) - Written in readable vanilla JavaScript ### Minimal API surface [The API](#api) was designed to provide only the minimum necessary functionality for creating a useful application, with or without [plugins](#plugins). **Base core** Base itself ships with only a handful of [useful methods](#api), such as: * `.set`: for setting values on the instance * `.get`: for getting values from the instance * `.has`: to check if a property exists on the instance * `.define`: for setting non-enumerable values on the instance * `.use`: for adding plugins **Be generic** When deciding on method to add or remove, we try to answer these questions: 1. Will all or most Base applications need this method? 2. Will this method encourage practices or enforce conventions that are beneficial to implementors? 3. Can or should this be done in a plugin instead? ### Composability **Plugin system** It couldn't be easier to extend Base with any features or custom functionality you can think of. Base plugins are just functions that take an instance of `Base`: ```js var base = new Base(); function plugin(base) { // do plugin stuff, in pure JavaScript } // use the plugin base.use(plugin); ``` Add "smart plugin" functionality with the [base-plugins](https://github.com/node-base/base-plugins) plugin. **Inheritance** Easily inherit Base using `.extend`: ```js var Base = require('base'); function MyApp() { Base.call(this); } Base.extend(MyApp); var app = new MyApp(); app.set('a', 'b'); app.get('a'); //=> 'b'; ``` **Inherit or instantiate with a namespace** By default, the `.get`, `.set` and `.has` methods set and get values from the root of the `base` instance. You can customize this using the `.namespace` method exposed on the exported function. For example: ```js var Base = require('base'); // get and set values on the `base.cache` object var base = Base.namespace('cache'); var app = base(); app.set('foo', 'bar'); console.log(app.cache.foo); //=> 'bar' ```
## Install **NPM** ## Install Install with [npm](https://www.npmjs.com/): ```sh $ npm install --save base ``` **yarn** Install with [yarn](yarnpkg.com): ```sh $ yarn add base && yarn upgrade ``` ## Usage ```js var Base = require('base'); var app = new Base(); // set a value app.set('foo', 'bar'); console.log(app.foo); //=> 'bar' // register a plugin app.use(function() { // do stuff (see API docs for ".use") }); ``` ## API ### [Base](index.js#L43) Create an instance of `Base` with the given `cache` and `options`. Learn about the [cache object](#cache-object). **Params** * `cache` **{Object}**: If supplied, this object is passed to [cache-base](https://github.com/jonschlinkert/cache-base) to merge onto the the instance. * `options` **{Object}**: If supplied, this object is used to initialize the `base.options` object. **Example** ```js // initialize with `cache` and `options` const app = new Base({isApp: true}, {abc: true}); app.set('foo', 'bar'); // values defined with the given `cache` object will be on the root of the instance console.log(app.baz); //=> undefined console.log(app.foo); //=> 'bar' // or use `.get` console.log(app.get('isApp')); //=> true console.log(app.get('foo')); //=> 'bar' // values defined with the given `options` object will be on `app.options console.log(app.options.abc); //=> true ``` ### [.is](index.js#L74) Set the given `name` on `app._name` and `app.is*` properties. Used for doing lookups in plugins. **Params** * `name` **{String}** * `returns` **{Boolean}** **Example** ```js app.is('collection'); console.log(app.type); //=> 'collection' console.log(app.isCollection); //=> true ``` ### [.isRegistered](index.js#L110) Returns true if a plugin has already been registered on an instance. Plugin implementors are encouraged to use this first thing in a plugin to prevent the plugin from being called more than once on the same instance. **Params** * `name` **{String}**: The plugin name. * `register` **{Boolean}**: If the plugin if not already registered, to record it as being registered pass `true` as the second argument. * `returns` **{Boolean}**: Returns true if a plugin is already registered. **Events** * `emits`: `plugin` Emits the name of the plugin being registered. Useful for unit tests, to ensure plugins are only registered once. **Example** ```js const base = new Base(); base.use(function(app) { if (app.isRegistered('myPlugin')) return; // do stuff to `app` }); // to also record the plugin as being registered base.use(function(app) { if (app.isRegistered('myPlugin', true)) return; // do stuff to `app` }); ``` ### [.use](index.js#L139) Call a plugin function or array of plugin functions on the instance. Plugins are called with an instance of base, and options (if defined). **Params** * `name` **{String|Function|Array}**: (optional) plugin name * `plugin` **{Function|Array}**: plugin function, or array of functions, to call. * **{...rest}**: Any additional arguments to pass to plugins(s). * `returns` **{Object}**: Returns the item instance for chaining. **Example** ```js const app = new Base() .use([foo, bar]) .use(baz) ``` ### [.define](index.js#L178) The `.define` method is used for adding non-enumerable property on the instance. Dot-notation is **not supported** with `define`. **Params** * `key` **{String}**: The name of the property to define. * `value` **{any}** * `returns` **{Object}**: Returns the instance for chaining. **Example** ```js // example of a custom arbitrary `render` function created with lodash's `template` method app.define('render', (str, locals) => _.template(str)(locals)); ``` ### [.base](index.js#L220) Getter/setter used when creating nested instances of `Base`, for storing a reference to the first ancestor instance. This works by setting an instance of `Base` on the `parent` property of a "child" instance. The `base` property defaults to the current instance if no `parent` property is defined. **Example** ```js // create an instance of `Base`, this is our first ("base") instance const first = new Base(); first.foo = 'bar'; // arbitrary property, to make it easier to see what's happening later // create another instance const second = new Base(); // create a reference to the first instance (`first`) second.parent = first; // create another instance const third = new Base(); // create a reference to the previous instance (`second`) // repeat this pattern every time a "child" instance is created third.parent = second; // we can always access the first instance using the `base` property console.log(first.base.foo); //=> 'bar' console.log(second.base.foo); //=> 'bar' console.log(third.base.foo); //=> 'bar' ``` ### [Base.use](index.js#L242) Static method for adding global plugin functions that will be added to an instance when created. **Params** * `fn` **{Function}**: Plugin function to use on each instance. * `returns` **{Object}**: Returns the `Base` constructor for chaining **Example** ```js Base.use(function(app) { app.foo = 'bar'; }); const app = new Base(); console.log(app.foo); //=> 'bar' ``` ## cache object **Cache** User-defined properties go on the `cache` object. This keeps the root of the instance clean, so that only reserved methods and properties on the root. ```js Base { cache: {} } ``` You can pass a custom object to use as the `cache` as the first argument to the `Base` class when instantiating. ```js const myObject = {}; const Base = require('base'); const base = new Base(myObject); ``` ## Toolkit suite Base is part of the [Toolkit suite](https://github.com/node-toolkit/getting-started) of applications. ### What is Toolkit? Toolkit is a collection of node.js libraries, applications and frameworks for helping developers quickly create high quality node.js applications, web projects, and command-line experiences. There are many other libraries on NPM for handling specific tasks, Toolkit provides the _systems_ and _building blocks_ for creating higher level workflows and processes around those libraries. Toolkit can be used to create a static site generator, blog framework, documentaton system, command line, task or plugin runner, and more! **Building Blocks** The following libraries can be used as "building blocks" for creating modular applications. * [base](https://github.com/node-base/base): (you are here!) framework for rapidly creating high quality node.js applications, using plugins like building blocks. Base serves as the foundation for several other applications in the [Toolkit suite](https://github.com/node-toolkit/getting-started). * [templates](https://github.com/jonschlinkert/templates): Render templates with any node.js template engine, create and manage template collections. Use helpers, layouts, partials, includes... * [enquirer](http://enquirer.io): Plugin-based prompt system for creating highly customizable command line experiences. * [composer](https://github.com/doowb/composer): Plugin-based, async task runner. **Lifecycle Applications** The following applications provide workflows and automation for common phases of the software development lifecycle. Each of these tools can be used entirely standalone or bundled together. * [generate](https://github.com/generate/generate): create projects * [assemble](https://github.com/assemble/assemble): build projects * [verb](https://github.com/verbose/verb): document projects * [update](https://github.com/update/update): maintain projects ## About ### Related projects * [base-cwd](https://www.npmjs.com/package/base-cwd): Base plugin that adds a getter/setter for the current working directory. | [homepage](https://github.com/node-base/base-cwd "Base plugin that adds a getter/setter for the current working directory.") * [base-data](https://www.npmjs.com/package/base-data): adds a `data` method to base-methods. | [homepage](https://github.com/node-base/base-data "adds a `data` method to base-methods.") * [base-fs](https://www.npmjs.com/package/base-fs): base-methods plugin that adds vinyl-fs methods to your 'base' application for working with the file… [more](https://github.com/node-base/base-fs) | [homepage](https://github.com/node-base/base-fs "base-methods plugin that adds vinyl-fs methods to your 'base' application for working with the file system, like src, dest, copy and symlink.") * [base-generators](https://www.npmjs.com/package/base-generators): Adds project-generator support to your `base` application. | [homepage](https://github.com/node-base/base-generators "Adds project-generator support to your `base` application.") * [base-option](https://www.npmjs.com/package/base-option): Adds a few options methods to base, like `option`, `enable` and `disable`. See the readme… [more](https://github.com/node-base/base-option) | [homepage](https://github.com/node-base/base-option "Adds a few options methods to base, like `option`, `enable` and `disable`. See the readme for the full API.") * [base-pipeline](https://www.npmjs.com/package/base-pipeline): base-methods plugin that adds pipeline and plugin methods for dynamically composing streaming plugin pipelines. | [homepage](https://github.com/node-base/base-pipeline "base-methods plugin that adds pipeline and plugin methods for dynamically composing streaming plugin pipelines.") * [base-pkg](https://www.npmjs.com/package/base-pkg): Plugin for adding a `pkg` method that exposes pkg-store to your base application. | [homepage](https://github.com/node-base/base-pkg "Plugin for adding a `pkg` method that exposes pkg-store to your base application.") * [base-plugins](https://www.npmjs.com/package/base-plugins): Adds 'smart plugin' support to your base application. | [homepage](https://github.com/node-base/base-plugins "Adds 'smart plugin' support to your base application.") * [base-questions](https://www.npmjs.com/package/base-questions): Plugin for base-methods that adds methods for prompting the user and storing the answers on… [more](https://github.com/node-base/base-questions) | [homepage](https://github.com/node-base/base-questions "Plugin for base-methods that adds methods for prompting the user and storing the answers on a project-by-project basis.") * [base-store](https://www.npmjs.com/package/base-store): Plugin for getting and persisting config values with your base-methods application. Adds a 'store' object… [more](https://github.com/node-base/base-store) | [homepage](https://github.com/node-base/base-store "Plugin for getting and persisting config values with your base-methods application. Adds a 'store' object that exposes all of the methods from the data-store library. Also now supports sub-stores!") * [base-task](https://www.npmjs.com/package/base-task): Base plugin that provides a very thin wrapper around [https://github.com/doowb/composer](https://github.com/doowb/composer) for adding task methods to… [more](https://github.com/base/base-task) | [homepage](https://github.com/base/base-task "Base plugin that provides a very thin wrapper around for adding task methods to your Base application.") ### Tests Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: ```sh $ npm install && npm test ``` ### Contributing Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). If Base doesn't do what you need, [please let us know](../../issues). ### Release History See the [changelog](CHANGELOG.md); ### Authors **Jon Schlinkert** * [github/jonschlinkert](https://github.com/jonschlinkert) * [twitter/jonschlinkert](http://twitter.com/jonschlinkert) **Brian Woodward** * [github/doowb](https://github.com/doowb) * [twitter/doowb](http://twitter.com/doowb) ### License Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert). MIT *** _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on March 29, 2018._base-3.0.0/changelog.md000066400000000000000000000051201325732526500147050ustar00rootroot00000000000000# Release History ## key Changelog entries are classified using the following labels from [keep-a-changelog][]: * `added`: for new features * `changed`: for changes in existing functionality * `deprecated`: for once-stable features removed in upcoming releases * `removed`: for deprecated features removed in this release * `fixed`: for any bug fixes Custom labels used in this changelog: * `dependencies`: bumps dependencies * `housekeeping`: code re-organization, minor edits, or other changes that don't fit in one of the other categories. **Heads up!** Please [let us know](../../issues) if any of the following heading links are broken. Thanks! ## [3.0.0] **Breaking changes** - Methods no longer set values on the root of the instance. By default, `.get`, `.get`, `.has`, `.del` and other method use the `base.cache` object. This can be customized by doing `new Base.create('foo')` where `foo` is the property name to use for the cache. ## [2.0.2] **Fixed** - Removed a check for function name in the `.use` method. This could cause plugins to not get registered. ## [2.0.0] **Changed** - Removed _static_ `.run` method since it's unnecessary (i.e. if you have the instance, you can just use `.use`) - adds support for passing arrays of functions to `.use` method ## [1.0.0] First major release! **Changed** - Refactored to use ES class ## [0.12.0] **Fixed** - ensure `__callbacks` and `super_` are non-enumberable **Added** - Now sets `app.type` when `app.is('foo')` is called. This allows Base instances to be used more like AST nodes, which is especially helpful with [smart plugins](https://github.com/node-base/base-plugins) ## [0.11.0] **Changed** - Static `.use` and `.run` methods are now non-enumerable ## [0.9.0](https://github.com/node-base/base/compare/0.8.0...0.9.0) **Changed** - `.is` no longer takes a function, a string must be passed - all remaining `.debug` code has been removed - `app._namespace` was removed (related to `debug`) - `.plugin`, `.use`, and `.define` no longer emit events - `.assertPlugin` was removed - `.lazy` was removed [2.0.2]: https://github.com/node-base/base/compare/1.0.0...2.0.2 [2.0.0]: https://github.com/node-base/base/compare/1.0.0...2.0.0 [1.0.0]: https://github.com/node-base/base/compare/0.13.2...1.0.0 [0.12.0]: https://github.com/node-base/base/compare/0.11.1...0.12.0 [0.11.0]: https://github.com/node-base/base/compare/0.10.0...0.11.0 [0.9.0]: https://github.com/node-base/base/compare/0.8.1...0.9.0 [Unreleased]: https://github.com/node-base/base/compare/0.1.1...HEAD [keep-a-changelog]: https://github.com/olivierlacan/keep-a-changelog base-3.0.0/docs/000077500000000000000000000000001325732526500133665ustar00rootroot00000000000000base-3.0.0/docs/logo.png000077500000000000000000002502401325732526500150420ustar00rootroot00000000000000PNG  IHDR qytEXtSoftwareAdobe ImageReadyqe<PBIDATxqǽᾪN oF@"w23gG> n$pM=I;x#;/Vr=/BޟLKZ -h_YWچ߃)}kLoU=fuvvi ާ XN*ANߖ9NS=h_*kS=x/&8Nw#/AsOEpJWvNuݷ&8\wUhbw#p8%Z̞YS1ؽw݈3%!/3}k~:QrvQ;iMxVТ"a//C's| ;ShA'@{ƹ`{Rr\ZcGS`־-lOǹXo#p_k;"px'%ǡ>dix;;WEkk{Hd RqZؾl7qޘ ~Bqeha{_.8o2w(9\[,o=q.1;a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163020ustar00rootroot00000000000000## Run gulp-like tasks Add the [base-task](https://github.com/node-base/base-task) plugin: ```js var task = require('base-task'); var Base = require('base'); var app = new Base(); // register the task plugin app.use(task()); app.task('default', function(cb) { // do task stuff cb(); }); // run the `default` task app.build(function(err) { if (err) throw err; }); ``` **Display run times** To log out run times in the terminal, add the [base-runtimes](https://github.com/node-base/base-runtimes) plugin: ```js var runtimes = require('base-runtimes'); var task = require('base-task'); var Base = require('base'); var app = new Base(); // register plugins app.use(runtimes()); app.use(task()); app.task('default', function(cb) { // do task stuff cb(); }); // run the `default` task app.build(function(err) { if (err) throw err; }); ``` base-3.0.0/index.js000066400000000000000000000173631325732526500141150ustar00rootroot00000000000000'use strict'; const assert = require('assert'); const typeOf = require('kind-of'); const define = require('define-property'); const pascal = require('pascalcase'); const merge = require('mixin-deep'); const Cache = require('cache-base'); /** * Optionally define a custom `cache` namespace to use. */ function namespace(name) { const fns = []; /** * Create an instance of `Base` with the given `cache` and `options`. * Learn about the [cache object](#cache-object). * * ```js * // initialize with `cache` and `options` * const app = new Base({isApp: true}, {abc: true}); * app.set('foo', 'bar'); * * // values defined with the given `cache` object will be on the root of the instance * console.log(app.baz); //=> undefined * console.log(app.foo); //=> 'bar' * // or use `.get` * console.log(app.get('isApp')); //=> true * console.log(app.get('foo')); //=> 'bar' * * // values defined with the given `options` object will be on `app.options * console.log(app.options.abc); //=> true * ``` * * @name Base * @param {Object} `cache` If supplied, this object is passed to [cache-base][] to merge onto the the instance. * @param {Object} `options` If supplied, this object is used to initialize the `base.options` object. * @api public */ class Base extends Cache { constructor(cache, options) { super(name, cache); this.is('base'); this.is('app'); this.options = merge({}, this.options, options); this.cache = this.cache || {}; this.define('registered', {}); if (fns.length) { this.use(fns); } } /** * Set the given `name` on `app._name` and `app.is*` properties. Used for doing * lookups in plugins. * * ```js * app.is('collection'); * console.log(app.type); * //=> 'collection' * console.log(app.isCollection); * //=> true * ``` * @name .is * @param {String} `name` * @return {Boolean} * @api public */ is(type) { assert.equal(typeof type, 'string', 'expected "type" to be a string'); if (type !== 'app') delete this.isApp; this.define('type', type.toLowerCase()); this.define('is' + pascal(type), true); return this; } /** * Returns true if a plugin has already been registered on an instance. * * Plugin implementors are encouraged to use this first thing in a plugin * to prevent the plugin from being called more than once on the same * instance. * * ```js * const base = new Base(); * base.use(function(app) { * if (app.isRegistered('myPlugin')) return; * // do stuff to `app` * }); * * // to also record the plugin as being registered * base.use(function(app) { * if (app.isRegistered('myPlugin', true)) return; * // do stuff to `app` * }); * ``` * @name .isRegistered * @emits `plugin` Emits the name of the plugin being registered. Useful for unit tests, to ensure plugins are only registered once. * @param {String} `name` The plugin name. * @param {Boolean} `register` If the plugin if not already registered, to record it as being registered pass `true` as the second argument. * @return {Boolean} Returns true if a plugin is already registered. * @api public */ isRegistered(name, register) { assert.equal(typeof name, 'string', 'expected name to be a string'); if (this.registered.hasOwnProperty(name)) { return true; } if (register !== false) { this.registered[name] = true; this.emit('plugin', name); } return false; } /** * Call a plugin function or array of plugin functions on the instance. Plugins * are called with an instance of base, and options (if defined). * * ```js * const app = new Base() * .use([foo, bar]) * .use(baz) * ``` * @name .use * @param {String|Function|Array} `name` (optional) plugin name * @param {Function|Array} `plugin` plugin function, or array of functions, to call. * @param {...rest} Any additional arguments to pass to plugins(s). * @return {Object} Returns the item instance for chaining. * @api public */ use(...rest) { let name = null; let fns = null; if (typeof rest[0] === 'string') { name = rest.shift(); } if (typeof rest[0] === 'function' || Array.isArray(rest[0])) { fns = rest.shift(); } if (Array.isArray(fns)) return fns.forEach(fn => this.use(fn, ...rest)); assert.equal(typeof fns, 'function', 'expected plugin to be a function'); const key = name; if (key && typeof key === 'string' && this.isRegistered(key)) { return this; } fns.call(this, this, ...rest); return this; } /** * The `.define` method is used for adding non-enumerable property on the instance. * Dot-notation is **not supported** with `define`. * * ```js * // example of a custom arbitrary `render` function created with lodash's `template` method * app.define('render', (str, locals) => _.template(str)(locals)); * ``` * @name .define * @param {String} `key` The name of the property to define. * @param {any} `value` * @return {Object} Returns the instance for chaining. * @api public */ define(key, val) { if (typeOf(key) === 'object') { return this.visit('define', key); } define(this, key, val); return this; } /** * Getter/setter used when creating nested instances of `Base`, for storing a reference * to the first ancestor instance. This works by setting an instance of `Base` on the `parent` * property of a "child" instance. The `base` property defaults to the current instance if * no `parent` property is defined. * * ```js * // create an instance of `Base`, this is our first ("base") instance * const first = new Base(); * first.foo = 'bar'; // arbitrary property, to make it easier to see what's happening later * * // create another instance * const second = new Base(); * // create a reference to the first instance (`first`) * second.parent = first; * * // create another instance * const third = new Base(); * // create a reference to the previous instance (`second`) * // repeat this pattern every time a "child" instance is created * third.parent = second; * * // we can always access the first instance using the `base` property * console.log(first.base.foo); * //=> 'bar' * console.log(second.base.foo); * //=> 'bar' * console.log(third.base.foo); * //=> 'bar' * ``` * @name .base * @api public */ get base() { return this.parent ? this.parent.base : this; } /** * Static method for adding global plugin functions that will * be added to an instance when created. * * ```js * Base.use(function(app) { * app.foo = 'bar'; * }); * const app = new Base(); * console.log(app.foo); * //=> 'bar' * ``` * @name #use * @param {Function} `fn` Plugin function to use on each instance. * @return {Object} Returns the `Base` constructor for chaining * @api public */ static use(fn) { assert.equal(typeof fn, 'function', 'expected plugin to be a function'); fns.push(fn); return this; } /** * Delete static mixin method from cache-base, JIT */ static get mixin() { return undefined; } } return Base; } /** * Expose `Base` with default settings */ module.exports = namespace(); /** * Allow users to define a namespace */ module.exports.namespace = namespace; base-3.0.0/package.json000066400000000000000000000046171325732526500147340ustar00rootroot00000000000000{ "name": "base", "description": "Framework for rapidly creating high quality, server-side node.js applications, using plugins like building blocks", "version": "3.0.0", "homepage": "https://github.com/node-base/base", "author": "Jon Schlinkert (https://github.com/jonschlinkert)", "maintainers": [ "Brian Woodward (https://github.com/doowb)", "Jon Schlinkert (https://github.com/jonschlinkert)" ], "contributors": [ "Brian Woodward (https://twitter.com/doowb)", "John O'Donnell (https://github.com/criticalmash)", "Jon Schlinkert (http://twitter.com/jonschlinkert)", "Olsten Larck (https://i.am.charlike.online)", "(https://github.com/wtgtybhertgeghgtwtg)" ], "repository": "node-base/base", "bugs": { "url": "https://github.com/node-base/base/issues" }, "license": "MIT", "files": [ "index.js" ], "main": "index.js", "engines": { "node": ">=6" }, "scripts": { "test": "mocha" }, "dependencies": { "cache-base": "^4.0.0", "define-property": "^2.0.2", "kind-of": "^6.0.2", "mixin-deep": "^1.3.1", "pascalcase": "^0.1.1" }, "devDependencies": { "gulp-format-md": "^1.0.0", "helper-changelog": "^0.3.0", "mocha": "^3.5.3", "through2": "^2.0.3", "verb-generate-readme": "^0.6.0" }, "keywords": [ "base", "boilerplate", "cache", "del", "get", "inherit", "methods", "set", "starter", "unset", "visit" ], "verb": { "run": true, "toc": "collapsible", "tasks": [ "readme" ], "plugins": [ "gulp-format-md" ], "helpers": [ "helper-changelog" ], "related": { "description": "There are a number of different plugins available for extending base. Let us know if you create your own!", "hightlight": "generate", "list": [ "base-cwd", "base-data", "base-fs", "base-generators", "base-option", "base-pipeline", "base-pkg", "base-plugins", "base-questions", "base-store", "base-task" ] }, "reflinks": [ "assemble", "base", "base-plugins", "cache-base", "class-utils", "enquirer", "generate", "helper-changelog", "prompt-base", "static-extend", "templates", "update", "verb" ], "lint": { "reflinks": true } } } base-3.0.0/test.js000066400000000000000000000371671325732526500137710ustar00rootroot00000000000000'use strict'; require('mocha'); const assert = require('assert'); let Base = require('./'); let base; describe('constructor', function() { it('should return an instance of Base', function() { base = new Base(); assert(base instanceof Base); }); it('should "visit" over an object to extend the instance', function() { base = new Base({ foo: 'bar' }); assert.equal(base.cache.foo, 'bar'); const app = new Base(null, { a: true, b: false }); assert(app.options); assert.equal(app.options.a, true); assert.equal(app.options.b, false); }); it('should map "visit" over an array to extend the instance', function() { base = new Base([{foo: 'bar'}, {baz: 'qux'}]); assert.equal(base.cache.foo, 'bar'); assert.equal(base.cache.baz, 'qux'); }); it('should set options passed as the second argument', function() { base = new Base(null, {abc: 'xyz'}); assert.equal(base.options.abc, 'xyz'); }); it('should merge options throughout the inheritance chain', function() { class Foo extends Base { constructor(options) { super(null, options); this.options.x = 'y'; } } class Bar extends Foo {} const bar = new Bar({a: 'b'}); assert.equal(bar.options.a, 'b'); assert.equal(bar.options.x, 'y'); }); it('should set isApp on the instance', function() { base = new Base(); assert.equal(base.isApp, true); }); }); describe('static properties', function() { beforeEach(function() { base = new Base(); }); it('should expose `.use` method', function() { assert.equal(typeof Base.use, 'function'); }); it('should extend static properties', function() { class Ctor extends Base {} assert.equal(typeof Ctor.use, 'function'); }); describe('.use', function() { it('should use a globally loaded plugin through the static use method', function() { class Ctor extends Base {} Ctor.use(function(app) { app.foo = 'bar'; }); const inst = new Ctor(); assert.equal(inst.foo, 'bar'); }); it('should use a globally loaded plugin through the static use method with namespace', function() { const Foo = Base.namespace('foo'); Foo.use(function(app) { app.set('bar', 'baz'); }); const inst = new Foo(); assert.equal(inst.get('bar'), 'baz'); assert.equal(inst.foo.bar, 'baz'); }); it('should use different globally installed plugins when using different namespaces', function() { const Foo = Base.namespace('foo'); const Bar = Base.namespace('bar'); Foo.use(function(app) { app.set('bar', 'baz'); }); Bar.use(function(app) { app.set('beep', 'boop'); }); const foo = new Foo(); const bar = new Bar(); assert.equal(foo.get('bar'), 'baz'); assert.equal(foo.foo.bar, 'baz'); assert.equal(typeof foo.get('beep'), 'undefined'); assert.equal(typeof foo.foo.beep, 'undefined'); assert.equal(bar.get('beep'), 'boop'); assert.equal(bar.bar.beep, 'boop'); assert.equal(typeof bar.get('bar'), 'undefined'); assert.equal(typeof bar.bar.bar, 'undefined'); }); }); }); describe('extend prototype methods', function() { beforeEach(function() { const Ctor = require('./'); Base = Ctor.namespace(); }); it('should extend the prototype of the given Ctor', function() { class Ctor extends Base {} assert.equal(typeof Ctor.use, 'function'); const ctor = new Ctor(); assert.equal(typeof ctor.set, 'function'); assert.equal(typeof ctor.get, 'function'); }); it('should expose `prototype.set` method', function() { assert.equal(typeof Base.prototype.set, 'function'); }); it('should expose `prototype.get` method', function() { assert.equal(typeof Base.prototype.get, 'function'); }); it('should expose `prototype.del` method', function() { assert.equal(typeof Base.prototype.del, 'function'); }); it('should expose `prototype.visit` method', function() { assert.equal(typeof Base.prototype.visit, 'function'); }); it('should expose `prototype.define` method', function() { assert.equal(typeof Base.prototype.define, 'function'); }); it('should add prototype methods to the given Ctor', function() { class Ctor extends Base {} assert.equal(typeof Ctor.prototype.set, 'function'); assert.equal(typeof Ctor.prototype.get, 'function'); assert.equal(typeof Ctor.prototype.del, 'function'); assert.equal(typeof Ctor.prototype.visit, 'function'); assert.equal(typeof Ctor.prototype.define, 'function'); }); }); describe('instance properties', function() { beforeEach(function() { const Ctor = require('./'); Base = Ctor.namespace(); base = new Base(); }); it('should expose the options property', function() { assert(base.options); assert.equal(typeof base.options, 'object'); }); it('should expose the cache property', function() { assert(base.cache); assert.equal(typeof base.cache, 'object'); }); }); describe('prototype methods', function() { beforeEach(function() { const Ctor = require('./'); Base = Ctor.namespace(); base = new Base(); }); describe('.use', function() { beforeEach(function() { base = new Base(); }); it('should expose a .use method', function() { assert(base.use); assert.equal(typeof base.use, 'function'); }); it('should call the function passed to `use`', function(cb) { base.use(function(app) { assert(app); cb(); }); }); it('should expose the app instance', function(cb) { base.foo = 'bar'; base.use(function(app) { assert.equal(app.foo, 'bar'); cb(); }); }); it('should expose the app instance as "this"', function(cb) { base.foo = 'bar'; base.use(function(app) { assert.equal(this.foo, 'bar'); cb(); }); }); it('should run a plugin multiple times', function() { base.count = 0; function plugin() { delete this.registered.plugin; this.count++; } base.use(plugin); base.use(plugin); base.use(plugin); assert.equal(base.count, 3); }); it('should not run a plugin more than once when a plugin name is given', function() { base.count = 0; function plugin() { this.count++; } base.use('foo', plugin); base.use('foo', plugin); base.use('foo', plugin); assert.equal(base.count, 1); }); }); describe('when `isRegistered` is used', function() { it('should not call a plugin more than once on the same instance', function() { base.i = 0; function plugin(app) { if (app.isRegistered('foo')) return; base.i++; } base.use(plugin); base.use(plugin); base.use(plugin); base.use(plugin); assert.equal(base.i, 1); }); it('should not register a plugin when `false` is passed as the 2nd arg', function() { function plugin(app) { if (app.isRegistered('foo', false)) return; this.foo = 'bar'; } base.use(plugin); assert(!base.registered.hasOwnProperty('foo')); assert.equal(base.foo, 'bar'); }); it('should not call a plugin more than once on the same instance', function() { base.i = 0; function plugin(app) { if (app.isRegistered('foo')) return; base.i++; } base.use(plugin); base.use(plugin); base.use(plugin); base.use(plugin); assert.equal(base.i, 1); }); }); describe('.define', function() { it('should define a key-value pair on the instance', function() { base.define('foo', 'bar'); assert.equal(base.foo, 'bar'); }); it('should define an own property', function() { base.define('foo', 'bar'); assert(base.hasOwnProperty('foo')); }); it('should define a non-emumerable property', function() { base.define('foo', 'bar'); assert(Object.keys(base).indexOf('foo') === -1); }); it('should multiple properties', function() { base.define({ foo: 'bar', baz: 'qux' }); assert(base.hasOwnProperty('foo')); assert(base.hasOwnProperty('baz')); }); }); describe('.set', function() { it('should set a key-value pair on the instance', function() { base.set('foo', 'bar'); assert.equal(base.cache.foo, 'bar'); }); it('should set nested property', function() { base.set('a.b.c', 'd'); assert.equal(base.cache.a.b.c, 'd'); }); it('should set a nested property with the key as an array', function() { base.set(['a', 'b', 'c'], 'd'); assert.equal(base.cache.a.b.c, 'd'); }); it('should set an object on the instance', function() { base.set({a: 'b'}); assert.equal(base.cache.a, 'b'); }); }); describe('.get', function() { it('should get a property from the instance', function() { base.set({a: 'b'}); assert.equal(base.get('a'), 'b'); }); it('should get a nested property from the instance', function() { base.set({a: {b: {c: 'd'}}}); assert.equal(base.get('a.b.c'), 'd'); }); it('should get a property using an array', function() { base.set({a: {b: {c: 'd'}}}); assert.equal(base.get(['a', 'b', 'c']), 'd'); }); it('should get a property using an array of path segments', function() { base.set({a: {b: {c: 'd'}}}); assert.equal(base.get(['a', 'b', 'c']), 'd'); assert.equal(base.get(['a.b', 'c']), 'd'); }); }); describe('.has', function() { it('should work with namespaces', function() { const Ctor = require('./'); Base = Ctor.namespace('cache'); const foo = new Base(); foo.set({a: 'b'}); assert.equal(foo.has('a'), true); }); it('should check for a property from the instance', function() { base.set({a: 'b'}); assert.equal(base.has('a'), true); }); it('should check for a nested property from the instance', function() { base.set({a: {b: {c: 'd'}}}); assert.equal(base.has('a.b.c'), true); }); it('should check for a property using an array', function() { base.set({a: {b: {c: 'd'}}}); assert.equal(base.has(['a', 'b', 'c']), true); }); it('should check for a property using a list of arguments', function() { base.set({a: {b: {c: 'd'}}}); assert.equal(base.has('a', 'b', 'c'), true); assert.equal(base.has(['a', 'b'], 'c'), true); assert.equal(base.has('a', ['b', 'c']), true); assert.equal(base.has('a', 'b.c'), true); }); }); describe('.visit', function() { it('should visit an object with the given method', function() { base.visit('set', {a: 'b', c: 'd'}); assert.equal(base.get('a'), 'b'); assert.equal(base.get('c'), 'd'); }); it('should visit an array with the given method', function() { base.visit('set', [{a: 'b', c: 'd'}]); assert.equal(base.get('a'), 'b'); assert.equal(base.get('c'), 'd'); }); }); describe('.del', function() { it('should remove a property', function() { base.set({a: 'b'}); assert.equal(base.cache.a, 'b'); base.del('a'); assert.equal(typeof base.cache.a, 'undefined'); }); it('should remove an array of properties', function() { base.set({ a: 'a' }); base.set({ b: 'b' }); assert.equal(base.cache.a, 'a'); assert.equal(base.cache.b, 'b'); base.del('a'); base.del('b'); assert.equal(typeof base.cache.a, 'undefined'); assert.equal(typeof base.cache.b, 'undefined'); }); }); }); describe('namespaces', function() { beforeEach(function() { Base = require('./'); }); describe('constructor', function() { it('should expose `namespace`', function() { assert.equal(typeof Base.namespace, 'function'); }); it('should extend the given Ctor with static methods', function() { const Foo = Base.namespace('cache'); class Ctor extends Foo {} assert.equal(typeof Ctor.use, 'function'); }); }); describe('prototype methods', function() { beforeEach(function() { const Custom = Base.namespace('cache'); base = new Custom(); }); describe('set', function() { it('should set a key-value pair on the instance', function() { base.set('foo', 'bar'); assert.equal(base.cache.foo, 'bar'); }); it('should set an object on the instance', function() { base.set({ a: 'b' }); assert.equal(base.cache.a, 'b'); }); }); describe('get', function() { it('should get a property from the instance', function() { base.set({ a: 'b' }); assert.equal(base.get('a'), 'b'); }); it('should visit an object with the given method', function() { base.visit('set', { a: 'b', c: 'd' }); assert.equal(base.get('a'), 'b'); assert.equal(base.get('c'), 'd'); }); it('should visit an array with the given method', function() { base.visit('set', [{ a: 'b', c: 'd' }]); assert.equal(base.get('a'), 'b'); assert.equal(base.get('c'), 'd'); }); }); describe('del', function() { it('should remove a property', function() { base.set({a: 'b'}); assert.equal(base.cache.a, 'b'); base.del('a'); assert.equal(typeof base.cache.a, 'undefined'); }); }); }); }); describe('.base', function() { beforeEach(function() { base = new Base(); }); it('should set a `base` property on the instance', function() { assert(base.base); assert.equal(typeof base.base, 'object'); }); it('should use `parent` to set app.base', function() { const foo = new Base(); foo.abc = 'xyz'; const bar = new Base(); bar.parent = foo; const baz = new Base(); baz.parent = bar; assert(baz.base); assert.equal(baz.base.abc, 'xyz'); }); }); describe('.is', function() { beforeEach(function() { const Ctor = require('./'); Base = Ctor.namespace(); base = new Base(); }); it('should set a name prefixed with `is` on the instance', function() { base.is('Foo'); assert(base.isFoo); assert.equal(base.type, 'foo'); assert.equal(base.isFoo, true); }); it('should remove isApp when another type is set', function() { base.is('Foo'); assert(base.isFoo); assert.equal(base.isApp, undefined); }); }); describe('events', function() { beforeEach(function() { base = new Base(); }); it('should emit and listen for events', function(cb) { base.on('foo', function(val) { assert.equal(val, 'bar'); cb(); }); base.emit('foo', 'bar'); }); it('should emit set', function(cb) { base.on('set', function(key, val) { assert.equal(key, 'foo'); assert.equal(val, 'bar'); cb(); }); base.set('foo', 'bar'); }); it('should emit get', function(cb) { base.on('get', function(key, val) { assert.equal(key, 'foo'); assert.equal(val, 'bar'); cb(); }); base.set('foo', 'bar'); base.get('foo'); }); it('should emit del', function(cb) { base.on('del', function(key, val) { assert.equal(key, 'foo'); cb(); }); base.set('foo', 'bar'); base.del('foo'); }); it('should emit when a named plugin is registered the first time', function() { const foo = () => () => {}; let count = 0; base = new Base(); base.on('plugin', () => (count++)); base.use('foo', foo()); base.use('foo', foo()); base.use('foo', foo()); base.use('foo', foo()); assert.equal(count, 1); }); }); base-3.0.0/verbfile.js000066400000000000000000000007301325732526500145720ustar00rootroot00000000000000'use strict'; var through = require('through2'); module.exports = function(app) { app.use(require('verb-generate-readme')); app.task('default', ['readme'], function(cb) { return app.src('README.md') .pipe(through.obj(function(file, enc, next) { var str = file.contents.toString(); str = str.replace(/^(#+ \[)#/gm, '$1Base.'); file.contents = new Buffer(str); next(null, file); })) .pipe(app.dest('.')); }); };