Skip to content
This repository has been archived by the owner on Sep 9, 2021. It is now read-only.

Commit

Permalink
v1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
amcdnl committed Nov 9, 2015
2 parents 1b54ba6 + a5f2e79 commit 27608c6
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 17 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ language: node_js
cache:
directories:
- node_modules
branches:
only:
- master
notifications:
email: false
node_js:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ reference GitHub issues that this commit **Closes**.

**Breaking Changes** should start with the word `BREAKING CHANGE:` with a space or two newlines. The rest of the commit message is then used for this.

A detailed explanation can be found in this [document][commit-message-format].
A detailed explanation can be found in this [document][https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit].

## <a name="coding"></a> Coding

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# modelFactory

[![Build Status](https://travis-ci.org/Swimlane/angular-model-factory.svg?branch=master)](https://travis-ci.org/Swimlane/model-factory) [![npm version](https://badge.fury.io/js/angular-model-factory.svg)](http://badge.fury.io/js/angular-model-factory) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) [![Codacy Badge](https://www.codacy.com/project/badge/d6659f50bd234f099738358a2a17bf9c)](https://www.codacy.com/public/amcdaniel2/model-factory) [![Join the chat at https://gitter.im/Swimlane/angular-model-factory](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Swimlane/angular-model-factory?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://travis-ci.org/Swimlane/angular-model-factory.svg?branch=master)](https://travis-ci.org/Swimlane/model-factory) [![npm version](https://badge.fury.io/js/angular-model-factory.svg)](http://badge.fury.io/js/angular-model-factory) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) [![Bower version](https://badge.fury.io/bo/angular-model-factory.svg)](http://badge.fury.io/bo/angular-model-factory) [![Codacy Badge](https://www.codacy.com/project/badge/d6659f50bd234f099738358a2a17bf9c)](https://www.codacy.com/public/amcdaniel2/model-factory) [![Join the chat at https://gitter.im/Swimlane/angular-model-factory](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Swimlane/angular-model-factory?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

A light-weight model layer that bridges the gap between AngularJS and your RESTful APIs.

Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@
"angular-scenario": "1.x"
},
"resolutions": {
"angular": "1.4.6"
"angular": "1.4.7"
}
}
34 changes: 25 additions & 9 deletions dist/angular-model-factory-bundle.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* modelFactory makes working with RESTful APIs in AngularJS easy
* @version v1.0.2 - 2015-09-27
* @version v1.0.3 - 2015-11-09
* @link http://swimlane.github.io/angular-model-factory/
* @author Austin McDaniel <amcdaniel2@gmail.com>, Juri Strumpflohner <juri.strumpflohner@gmail.com>
* @license MIT License, http://www.opensource.org/licenses/MIT
Expand Down Expand Up @@ -28,7 +28,7 @@
var uriTemplateSuffices = {
"*": true
};

function notReallyPercentEncode(string) {
return encodeURI(string).replace(/%25[0-9][0-9]/g, function (doubleEncoded) {
return "%" + doubleEncoded.substring(3);
Expand Down Expand Up @@ -180,7 +180,7 @@
for (var i = 0; i < arrayValue.length; i++) {
var stringValue = arrayValue[i];
if (shouldEscape && stringValue.indexOf('=') != -1) {
hasEquals = true;
hasEquals = true;
}
var innerArrayValue = stringValue.split(",");
for (var j = 0; j < innerArrayValue.length; j++) {
Expand All @@ -194,11 +194,15 @@
arrayValue[i] = innerArrayValue;
}
}

if (showVariables || hasEquals) {
var objectValue = resultObj[varName] || {};
for (var j = 0; j < arrayValue.length; j++) {
var innerValue = stringValue;
if (showVariables && !innerValue) {
// The empty string isn't a valid variable, so if our value is zero-length we have nothing
continue;
}
if (typeof arrayValue[j] == "string") {
var stringValue = arrayValue[j];
var innerVarName = stringValue.split("=", 1)[0];
Expand Down Expand Up @@ -274,8 +278,13 @@
}
for (var i = 0; i < arrayValue.length; i++) {
var stringValue = arrayValue[i];
if (!stringValue && showVariables) {
// The empty string isn't a valid variable, so if our value is zero-length we have nothing
continue;
}
var innerArrayValue = stringValue.split(",");

var hasEquals = false;

if (showVariables) {
var stringValue = innerArrayValue[0]; // using innerArrayValue
var varName = stringValue.split("=", 1)[0];
Expand Down Expand Up @@ -339,6 +348,13 @@
varNames = varNames.concat(funcs.substitution.varNames);
}
this.fill = function (valueFunction) {
if (valueFunction && typeof valueFunction !== 'function') {
var value = valueFunction;
valueFunction = function (varName) {
return value[varName];
};
}

var result = textParts[0];
for (var i = 0; i < substitutions.length; i++) {
var substitution = substitutions[i];
Expand Down Expand Up @@ -378,6 +394,7 @@
substituted = substituted.substring(nextPartPos);
} else if (prefixes[offset + 1]) {
var nextPartPos = substituted.indexOf(prefixes[offset + 1]);
if (nextPartPos === -1) nextPartPos = substituted.length;
var stringValue = substituted.substring(0, nextPartPos);
substituted = substituted.substring(nextPartPos);
} else if (textParts.length > offset + 2) {
Expand All @@ -403,14 +420,13 @@
return this.template;
},
fillFromObject: function (obj) {
return this.fill(function (varName) {
return obj[varName];
});
return this.fill(obj);
}
};

return UriTemplate;
});

/* global angular:false */
'use strict';

Expand Down
4 changes: 2 additions & 2 deletions dist/angular-model-factory-bundle.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/angular-model-factory.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* modelFactory makes working with RESTful APIs in AngularJS easy
* @version v1.0.2 - 2015-09-27
* @version v1.0.3 - 2015-11-09
* @link http://swimlane.github.io/angular-model-factory/
* @author Austin McDaniel <amcdaniel2@gmail.com>, Juri Strumpflohner <juri.strumpflohner@gmail.com>
* @license MIT License, http://www.opensource.org/licenses/MIT
Expand Down
2 changes: 1 addition & 1 deletion dist/angular-model-factory.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"publish-latest": "^1.1.2",
"semantic-release": "^4.3.5"
},
"main": "./dist/angular-model-factory.js",
"scripts": {
"build": "grunt build",
"prepublish": "npm run build",
Expand All @@ -37,5 +38,5 @@
"type": "git",
"url": "https://github.com/Swimlane/angular-model-factory.git"
},
"version": "1.0.2"
"version": "1.0.3"
}

0 comments on commit 27608c6

Please sign in to comment.