Socket
Socket
Sign inDemoInstall

@wulechuan/apply-one-stage-one-method-pattern

Package Overview
Dependencies
0
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.9 to 1.0.10

build/@wulechuan-apply-one-stage-one-method-pattern.min.js

4

.vscode/settings.json

@@ -6,3 +6,5 @@ {

, "node_modules": true
}
},
"express.portNumber": 8383,
"express.relativeRoot": "examples/example-001/"
}

@@ -5,8 +5,35 @@ # API

var stageMethodsOwner = {};
var stages = new WulechuanApplyOneStageOneMethodProgrammingPatternTo(stageMethodsOwner);
Construct a operator to manage the stages for another object, called "methods owner".
Generally, the operator helps the methods owner, by exposing or hiding some methods for the methods owner at correct stage.
#### Signature
// Note that the stagesOperator is NOT the stageMethodsOwner.
var stagesOperator = new WulechuanApplyOneStageOneMethodProgrammingPatternToMethodsOwner(
stageMethodsOwner,
preferredLanguage
);
#### arguments
- **stageMethodsOwner** [required]
The object to add or remove methods upon.
- **preferredLanguage** [Optional]
The preferred language for exposing and hiding methods.
This argument is optional here as constructing an instance, but the preferred language is required anyway before starting from the first stage.
#### Usage
var StagesOperator = require('@wulechuan/apply-one-stage-one-method-pattern');
var a = {};
var stagesOperator = new StagesOperator(a, 'en-US');
## Methods

@@ -20,27 +47,72 @@

function addStage(stageAction, thisStageCanBeSkipped, actionAliasesInAllLanguages);
Might be any of below:
function addStage(
stageAction, /* a function */
actionAliasesInAllLanguages /* an object */
);
function addStage(
stageAction, /* a function */
thisStageCanBeSkipped, /* a boolean */
actionAliasesInAllLanguages /* an object */
);
function addStage(
stageAction, /* a function */
anAliasInPreferredLanguage /* a non-empty string */
);
function addStage(
stageAction, /* a function */
thisStageCanBeSkipped, /* a boolean */
anAliasInPreferredLanguage /* a non-empty string */
);
#### Arguments
- **stageAction**
- **stageAction** [required]
Must be a **function**.
Must be a **function**.
A function that will be added to the operator as its method at correct stage.
A function that will be added to the operator as its method at correct stage.
- **thisStageCanBeSkipped**
- **thisStageCanBeSkipped** [Optional]
Must be a **boolean**.
Must be a **boolean**.
A value of **true** means the stage being added is an optional stage, so that the method after this optional stage should also be exposed at the previous stage of this optional stage.
A value of **true** means the stage being added is an optional stage, so that the method after this optional stage should also be exposed at the previous stage of this optional stage.
- **thisStageCanBeSkipped**
- **actionAliasesInAllLanguages** [required]
Must be an **object**.
- If the preferred language has **NOT** been set before the invocation of this method,
then this argument must be an **object**.
- If the preferred language has been set before the invocation of this method,
then a non-empty string is allowed, which will be treated as the alias in the preferred language. Of course, an object is allowed as always.
An object that takes several **array**s, each contains aliases in a specific language.
An object that takes several **array**s, each contains aliases in a specific language.
#### Usage
stageOperator.addStage(aFunction, {
'en-US': 'myFirstMethod',
'zh-CN': '第一步'
});
// or
stageOperator.addStage(
anotherFunction,
true // Skippable,
'nonImportantStep'
);
// or
stageOperator.addStage(
anotherFunction,
'youCanNotSkipMe'
);
### setPreferredNaturalLanguageTo

@@ -58,7 +130,10 @@

Must be a non-empty **string**.
Must be a non-empty **string**.
#### Usage
stageOperator.setPreferredNaturalLanguageTo('en-US');
### startFromFirstStage

@@ -76,15 +151,23 @@

#### Usage
stageOperator.startFromFirstStage();
### stop
### abort
Stop the execution chain on the methods owner.
If invoked withing a given stage, all methods for all subsequence stages
will be skipped. And the finally returned value of the last stage is
**always** undefined.
If this method of the **operator** is invoked, all methods for all subsequence stages of the owner will be skipped.
And the finally returned value of the last stage is **always** undefined.
- Tip:
This method of the **operator** is often, though not forced to be, invoked withing a method of the **methods owner**, which make sense.
#### Signature
function stop();
function abort();

@@ -95,2 +178,6 @@ #### Arguments

#### Usage
stageOperator.abort();
const productionSourceGlobJs = ['source/**/*.js'];
const examplesFolder = 'examples';
const examplesGlobs = [examplesFolder+'/**/*.js'];
const productionBuildFolder = 'build';

@@ -6,11 +8,13 @@ const readMeStartRegExp = new RegExp('(\\* \\s*\\-{3,} readme start \\-{3,}\\s*)\\n', 'i');

const allSourceGlobsToWatch = productionSourceGlobJs;
const allSourceGlobsToWatch = productionSourceGlobJs.concat(
[examplesFolder + '/**/index.*']
);
const globsToClearBeforeRebuilding = [
productionBuildFolder
productionBuildFolder,
examplesFolder + '/**/webpack*.js',
examplesFolder + '/**/*.js.map'
];
const processArguments = require('minimist')(process.argv.slice(2));

@@ -25,2 +29,3 @@

const pump = require('pump');
const webpack = require('webpack-stream');

@@ -55,6 +60,2 @@

(function 构建README() {

@@ -151,2 +152,9 @@ gulp.task('build: readme', (thisTaskIsDone) => {

gulp.task('webpack: examples', () => {
return gulp.src(examplesGlobs)
.pipe(webpack(require('./webpack.config.js')))
.pipe(gulp.dest('.'))
;
});
gulp.task('build: all', (thisTaskIsDone) => {

@@ -158,3 +166,4 @@ var tasksToRun = [

'build: js: all'
]
],
'webpack: examples'
];

@@ -161,0 +170,0 @@

{
"name": "@wulechuan/apply-one-stage-one-method-pattern",
"version": "1.0.9",
"version": "1.0.10",
"description": "凡由本类构建的实例对象,可用于将本人设计的一种程序设计模式应用至另一“受体”对象。“受体”因而被改造,其各个所涉及之方法函数均被依次对应于各自的所谓“执行阶段”,亦可称“步骤”,每个方法函数对应一个步骤。自此时起,仅第一个步骤所对应的方法函数被公开(或称“曝露”),其余后续步骤之方法函数均被隐藏,直至各自前导执行阶段完成,这些方法函数才会陆续公开。",
"main": "build/wulechuan-one-method-one-stage-pattern-builder.min.js",
"main": "build/@wulechuan-apply-one-stage-one-method-pattern.min.js",
"scripts": {
"dev": "require-self && gulp",
"release": "gulp --release",
"test": "echo \"Error: no test specified\" && exit 1"

@@ -18,2 +20,3 @@ },

"del": "^3.0.0",
"glob": "^7.1.2",
"gulp": "^3.9.1",

@@ -25,3 +28,7 @@ "gulp-change": "^1.0.0",

"minimist": "^1.2.0",
"pump": "^1.0.2"
"path": "^0.12.7",
"pump": "^1.0.2",
"require-self": "^0.2.1",
"uglifyjs-webpack-plugin": "^0.4.6",
"webpack-stream": "^3.2.0"
},

@@ -28,0 +35,0 @@ "repository": {

@@ -126,3 +126,3 @@ # 中文介绍

var stagesBuilder = new WulechuanApplyOneStageOneMethodProgrammingPatternFor(this);
var stagesBuilder = new WulechuanApplyOneStageOneMethodProgrammingPatternToMethodsOwner(this);

@@ -129,0 +129,0 @@ stagesBuilder.addStage(methodAsStage1, true, {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc