This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function checkNameSpace(parent, nested) { | |
nested = nested || ''; | |
return typeof parent === 'object' && | |
typeof nested === 'string' && | |
typeof nested | |
.split(/[\.\["'\]]/) | |
.filter(function(el) { | |
return el; | |
}) | |
.reduce(function(acc, nested) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function splitBy (by, str) { | |
return (function splitByFourAux (input, index, acc, string) { | |
return index > input.length -1 ? | |
(string ? acc.concat(string) : acc) : | |
index % by === by - 1 ? | |
splitByFourAux(input, index + 1, acc.concat(string.concat(input.charAt(index))), '') : | |
splitByFourAux(input, index + 1, acc, string.concat(input.charAt(index))); | |
})(str, 0, [], ''); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function compressString (str) { | |
return (function compressAux(str, index, acc) { | |
return index > str.length -1 ? | |
'' : | |
str.charAt(index) === str.charAt(index + 1) ? | |
compressAux(str, ++index, ++acc) : | |
str.charAt(index) + (acc !== 1 ? acc : '') + compressAux(str, ++index, 1); | |
})(str, 0, 1); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function _get(parent, nested) { | |
return typeof nested === 'string' ? | |
(typeof parent === 'object' && | |
nested | |
.split(/[\.\["'\]]/) | |
.filter(Boolean) | |
.reduce(function(acc, current) { | |
return acc && acc[current] | |
}, parent)) : | |
parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var puntillo = (function () { | |
function get(parent, nested, defValue) { | |
return splitMy(nested) | |
.reduce(function(acc, current) { | |
return acc ? acc[current] : defValue; | |
}, parent); | |
} | |
function set(parent, nested, defValue) { | |
return splitMy(nested) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugins: | |
- serverless-s3-sync | |
custom: | |
s3Sync: | |
- bucketName: swagger-site-${opt:stage, 'dev'} | |
localDir: swagger-ui-dist | |
deleteRemoved: true # optional, indicates whether sync deletes files no longer present in localDir. Defaults to 'true' | |
acl: public-read # optional | |
followSymlinks: true # optional | |
defaultContentType: text/html # optional |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resources: | |
Resources: | |
ApiGatewayRestApi: | |
Type: AWS::ApiGateway::RestApi | |
Description: Gateway to the s3 Swagger site | |
Properties: | |
Name: swagger-${opt:stage, 'dev'} | |
EndpointConfiguration: | |
Types: | |
- REGIONAL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ApiGatewayMethodGetRoot: | |
Type: AWS::ApiGateway::Method | |
Description: Located at root resource to proxy to S3 bucket website | |
Properties: | |
HttpMethod: GET | |
ResourceId: | |
Fn::GetAtt: [ApiGatewayRestApi, RootResourceId] | |
RestApiId: !Ref ApiGatewayRestApi | |
ApiKeyRequired: false | |
AuthorizationType: NONE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ApiGatewayResourceItem: | |
Type: AWS::ApiGateway::Resource | |
Properties: | |
ParentId: | |
Fn::GetAtt: [ApiGatewayRestApi, RootResourceId] | |
PathPart: '{item}' | |
RestApiId: !Ref ApiGatewayRestApi | |
ApiGatewayMethodGetItem: | |
Type: AWS::ApiGateway::Method | |
Description: Located at {item} resource to get items from S3 bucket |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GatewayRole: | |
Type: AWS::IAM::Role | |
Properties: | |
AssumeRolePolicyDocument: | |
Version: '2012-10-17' | |
Statement: | |
- Effect: Allow | |
Principal: | |
Service: | |
- apigateway.amazonaws.com |
OlderNewer